mirror of
https://github.com/jellyfin/TMDbLib.git
synced 2024-11-26 15:20:23 +00:00
Rewrite tests to use Verify library
This commit is contained in:
parent
82a1573827
commit
71452ad567
11
.gitignore
vendored
11
.gitignore
vendored
@ -2,4 +2,13 @@
|
||||
bin/
|
||||
obj/
|
||||
*.user
|
||||
Build/
|
||||
Build/
|
||||
*.DotSettings
|
||||
|
||||
# Project specific
|
||||
TestApplication/config.json
|
||||
*.lock.json
|
||||
|
||||
# Verify
|
||||
# https://github.com/VerifyTests/Verify#received-and-verified
|
||||
*.received.*
|
@ -10,7 +10,7 @@ namespace TMDbLib.Client
|
||||
{
|
||||
public partial class TMDbClient
|
||||
{
|
||||
private async Task<T> GetChangesInternal<T>(string type, int page = 0, int? id = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
private async Task<T> GetChangesInternal<T>(string type, int page = 0, int? id = null, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
string resource;
|
||||
if (id.HasValue)
|
||||
@ -50,7 +50,7 @@ namespace TMDbLib.Client
|
||||
/// You can then use the movie changes API to get the actual data that has been changed. (.GetMovieChangesAsync)
|
||||
/// </summary>
|
||||
/// <remarks>the change log system to support this was changed on October 5, 2012 and will only show movies that have been edited since.</remarks>
|
||||
public async Task<SearchContainer<ChangesListItem>> GetChangesMoviesAsync(int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
public async Task<SearchContainer<ChangesListItem>> GetMoviesChangesAsync(int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await GetChangesInternal<SearchContainer<ChangesListItem>>("movie", page, startDate: startDate, endDate: endDate, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
@ -62,7 +62,7 @@ namespace TMDbLib.Client
|
||||
/// You can then use the person changes API to get the actual data that has been changed.(.GetPersonChangesAsync)
|
||||
/// </summary>
|
||||
/// <remarks>the change log system to support this was changed on October 5, 2012 and will only show people that have been edited since.</remarks>
|
||||
public async Task<SearchContainer<ChangesListItem>> GetChangesPeopleAsync(int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
public async Task<SearchContainer<ChangesListItem>> GetPeopleChangesAsync(int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await GetChangesInternal<SearchContainer<ChangesListItem>>("person", page, startDate: startDate, endDate: endDate, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
@ -77,30 +77,30 @@ namespace TMDbLib.Client
|
||||
/// the change log system to properly support TV was updated on May 13, 2014.
|
||||
/// You'll likely only find the edits made since then to be useful in the change log system.
|
||||
/// </remarks>
|
||||
public async Task<SearchContainer<ChangesListItem>> GetChangesTvAsync(int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
public async Task<SearchContainer<ChangesListItem>> GetTvChangesAsync(int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await GetChangesInternal<SearchContainer<ChangesListItem>>("tv", page, startDate: startDate, endDate: endDate, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<IList<Change>> GetChangesMovieAsync(int movieId, int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
public async Task<IList<Change>> GetMovieChangesAsync(int movieId, int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ChangesContainer changesContainer = await GetChangesInternal<ChangesContainer>("movie", page, movieId, startDate, endDate, cancellationToken);
|
||||
return changesContainer.Changes;
|
||||
}
|
||||
|
||||
public async Task<IList<Change>> GetChangesPersonAsync(int personId, int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
public async Task<IList<Change>> GetPersonChangesAsync(int personId, int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ChangesContainer changesContainer = await GetChangesInternal<ChangesContainer>("person", page, personId, startDate, endDate, cancellationToken).ConfigureAwait(false);
|
||||
return changesContainer.Changes;
|
||||
}
|
||||
|
||||
public async Task<IList<Change>> GetChangesTvSeasonAsync(int seasonId, int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
public async Task<IList<Change>> GetTvSeasonChangesAsync(int seasonId, int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ChangesContainer changesContainer = await GetChangesInternal<ChangesContainer>("tv/season", page, seasonId, startDate, endDate, cancellationToken).ConfigureAwait(false);
|
||||
return changesContainer.Changes;
|
||||
}
|
||||
|
||||
public async Task<IList<Change>> GetChangesTvEpisodeAsync(int episodeId, int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
public async Task<IList<Change>> GetTvEpisodeChangesAsync(int episodeId, int page = 0, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ChangesContainer changesContainer = await GetChangesInternal<ChangesContainer>("tv/episode", page, episodeId, startDate, endDate, cancellationToken).ConfigureAwait(false);
|
||||
return changesContainer.Changes;
|
||||
|
@ -169,12 +169,6 @@ namespace TMDbLib.Client
|
||||
return item;
|
||||
}
|
||||
|
||||
public async Task<List<Change>> GetMovieChangesAsync(int movieId, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ChangesContainer changesContainer = await GetMovieMethodInternal<ChangesContainer>(movieId, MovieMethods.Changes, startDate: startDate, endDate: endDate, dateFormat: "yyyy-MM-dd HH:mm:ss UTC", cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
return changesContainer.Changes;
|
||||
}
|
||||
|
||||
public async Task<Credits> GetMovieCreditsAsync(int movieId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await GetMovieMethodInternal<Credits>(movieId, MovieMethods.Credits, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
|
@ -102,12 +102,6 @@ namespace TMDbLib.Client
|
||||
return item;
|
||||
}
|
||||
|
||||
public async Task<List<Change>> GetPersonChangesAsync(int personId, DateTime? startDate = null, DateTime? endDate = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ChangesContainer changesContainer = await GetPersonMethodInternal<ChangesContainer>(personId, PersonMethods.Changes, startDate: startDate, endDate: endDate, dateFormat: "yyyy-MM-dd HH:mm:ss UTC", cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
return changesContainer.Changes;
|
||||
}
|
||||
|
||||
public async Task<ExternalIdsPerson> GetPersonExternalIdsAsync(int personId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await GetPersonMethodInternal<ExternalIdsPerson>(personId, PersonMethods.ExternalIds, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
|
@ -119,16 +119,6 @@ namespace TMDbLib.Client
|
||||
return item;
|
||||
}
|
||||
|
||||
public async Task<ChangesContainer> GetTvEpisodeChangesAsync(int episodeId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
RestRequest req = _client.Create("tv/episode/{id}/changes");
|
||||
req.AddUrlSegment("id", episodeId.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
RestResponse<ChangesContainer> response = await req.Get<ChangesContainer>(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return await response.GetDataObject();
|
||||
}
|
||||
|
||||
public async Task<ResultContainer<TvEpisodeInfo>> GetTvEpisodesScreenedTheatricallyAsync(int tvShowId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
RestRequest req = _client.Create("tv/{tv_id}/screened_theatrically");
|
||||
|
@ -118,16 +118,6 @@ namespace TMDbLib.Client
|
||||
return item;
|
||||
}
|
||||
|
||||
public async Task<ChangesContainer> GetTvSeasonChangesAsync(int seasonId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
RestRequest req = _client.Create("tv/season/{id}/changes");
|
||||
req.AddUrlSegment("id", seasonId.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
RestResponse<ChangesContainer> response = await req.Get<ChangesContainer>(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return await response.GetDataObject();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a credits object for the season of the tv show associated with the provided TMDb id.
|
||||
/// </summary>
|
||||
|
@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using TMDbLib.Utilities;
|
||||
using TMDbLib.Utilities;
|
||||
|
||||
namespace TMDbLib.Objects.Discover
|
||||
{
|
||||
public enum DiscoverMovieSortBy
|
||||
{
|
||||
[Obsolete]
|
||||
Undefined,
|
||||
[EnumValue("popularity.asc")]
|
||||
Popularity,
|
||||
|
@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using TMDbLib.Utilities;
|
||||
using TMDbLib.Utilities;
|
||||
|
||||
namespace TMDbLib.Objects.Discover
|
||||
{
|
||||
public enum DiscoverTvShowSortBy
|
||||
{
|
||||
[Obsolete]
|
||||
Undefined,
|
||||
[EnumValue("vote_average.asc")]
|
||||
VoteAverage,
|
||||
|
@ -3,7 +3,7 @@ using TMDbLib.Objects.General;
|
||||
|
||||
namespace TMDbLib.Objects.Lists
|
||||
{
|
||||
public class AccountList : List
|
||||
public class AccountList : TMDbList<int>
|
||||
{
|
||||
[JsonProperty("list_type")]
|
||||
public MediaType ListType { get; set; }
|
||||
|
@ -4,7 +4,7 @@ using TMDbLib.Objects.Search;
|
||||
|
||||
namespace TMDbLib.Objects.Lists
|
||||
{
|
||||
public class GenericList : List
|
||||
public class GenericList : TMDbList<string>
|
||||
{
|
||||
[JsonProperty("created_by")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace TMDbLib.Objects.Lists
|
||||
{
|
||||
public class List
|
||||
public abstract class TMDbList<TId>
|
||||
{
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
@ -11,7 +11,7 @@ namespace TMDbLib.Objects.Lists
|
||||
public int FavoriteCount { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
public TId Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A language code, e.g. en
|
@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using TMDbLib.Objects.General;
|
||||
|
||||
namespace TMDbLib.Objects.Movies
|
||||
{
|
||||
@ -18,10 +19,13 @@ namespace TMDbLib.Objects.Movies
|
||||
/// </summary>
|
||||
[JsonProperty("iso_639_1")]
|
||||
public string Iso_639_1 { get; set; }
|
||||
|
||||
|
||||
[JsonProperty("item_Count")]
|
||||
public int ItemCount { get; set; }
|
||||
|
||||
[JsonProperty("list_type")]
|
||||
public MediaType ListType { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
@ -33,6 +33,9 @@ namespace TMDbLib.Utilities.Converters
|
||||
return new List<int>();
|
||||
}
|
||||
|
||||
if (reader.TokenType == JsonToken.Null)
|
||||
return null;
|
||||
|
||||
throw new Exception("Unable to convert list of integers");
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Account;
|
||||
using TMDbLib.Objects.Authentication;
|
||||
using TMDbLib.Objects.General;
|
||||
using TMDbLib.Objects.Lists;
|
||||
@ -16,7 +15,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
public class ClientAccountTests : TestBase
|
||||
{
|
||||
public ClientAccountTests() : base()
|
||||
public ClientAccountTests()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(TestConfig.UserSessionId))
|
||||
throw new ConfigurationErrorsException("To successfully complete the ClientAccountTests you will need to specify a valid 'UserSessionId' in the test config file");
|
||||
@ -34,177 +33,109 @@ namespace TMDbLibTests
|
||||
public async Task TestAccountGetDetailsUserAccount()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountDetails account = await TMDbClient.AccountGetDetailsAsync();
|
||||
|
||||
// Naturally the specified account must have these values populated for the test to pass
|
||||
Assert.NotNull(account);
|
||||
Assert.True(account.Id > 1);
|
||||
Assert.Equal("Test Name", account.Name);
|
||||
Assert.Equal("TMDbTestAccount", account.Username);
|
||||
Assert.Equal("BE", account.Iso_3166_1);
|
||||
Assert.Equal("en", account.Iso_639_1);
|
||||
|
||||
Assert.NotNull(account.Avatar);
|
||||
Assert.NotNull(account.Avatar.Gravatar);
|
||||
Assert.Equal("7cf5357dbc2014cbd616257c358ea0a1", account.Avatar.Gravatar.Hash);
|
||||
await Verify(TMDbClient.ActiveAccount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAccountAccountGetLists()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetListsAsync(i));
|
||||
AccountList list = (await TMDbClient.AccountGetListsAsync()).Results[0];
|
||||
|
||||
Assert.NotNull(list.Id);
|
||||
Assert.NotNull(list.Name);
|
||||
Assert.Null(list.PosterPath);
|
||||
Assert.NotNull(list.Description);
|
||||
Assert.NotNull(list.Iso_639_1);
|
||||
SearchContainer<AccountList> result = await TMDbClient.AccountGetListsAsync();
|
||||
|
||||
Assert.NotEmpty(result.Results);
|
||||
|
||||
AccountList single = result.Results.Single(s => s.Id == 1724);
|
||||
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact(Skip = "TMDb has an issue in pagination of AccountGetListsAsync")]
|
||||
public async Task TestAccountAccountGetListsPaged()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetListsAsync(i));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAccountGetFavoriteMovies()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteMoviesAsync(i));
|
||||
SearchMovie movie = (await TMDbClient.AccountGetFavoriteMoviesAsync()).Results[0];
|
||||
|
||||
// Requires that you have marked at least one movie as favorite else this test will fail
|
||||
Assert.True(movie.Id > 0);
|
||||
Assert.NotNull(movie.Title);
|
||||
Assert.NotNull(movie.PosterPath);
|
||||
Assert.NotNull(movie.BackdropPath);
|
||||
Assert.NotNull(movie.OriginalTitle);
|
||||
Assert.NotNull(movie.Overview);
|
||||
Assert.NotNull(movie.OriginalLanguage);
|
||||
Assert.NotNull(movie.ReleaseDate);
|
||||
Assert.True(movie.VoteCount > 0);
|
||||
Assert.True(movie.VoteAverage > 0);
|
||||
Assert.True(movie.Popularity > 0);
|
||||
SearchContainer<SearchMovie> movies = await TMDbClient.AccountGetFavoriteMoviesAsync();
|
||||
SearchMovie movie = movies.Results.Single(s => s.Id == IdHelper.Avatar);
|
||||
|
||||
Assert.NotNull(movie.GenreIds);
|
||||
Assert.True(movie.GenreIds.Any());
|
||||
await Verify(movie, x => x.IgnoreProperty<SearchMovie>(n => n.VoteCount, n => n.Popularity));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAccountGetFavoriteTv()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteTvAsync(i));
|
||||
SearchTv tvShow = (await TMDbClient.AccountGetFavoriteTvAsync()).Results[0];
|
||||
|
||||
// Requires that you have marked at least one movie as favorite else this test will fail
|
||||
Assert.True(tvShow.Id > 0);
|
||||
Assert.NotNull(tvShow.Name);
|
||||
Assert.NotNull(tvShow.PosterPath);
|
||||
Assert.NotNull(tvShow.BackdropPath);
|
||||
Assert.NotNull(tvShow.OriginalName);
|
||||
Assert.NotNull(tvShow.Overview);
|
||||
Assert.NotNull(tvShow.OriginalLanguage);
|
||||
Assert.NotNull(tvShow.FirstAirDate);
|
||||
Assert.True(tvShow.VoteCount > 0);
|
||||
Assert.True(tvShow.VoteAverage > 0);
|
||||
Assert.True(tvShow.Popularity > 0);
|
||||
SearchContainer<SearchTv> tvShows = await TMDbClient.AccountGetFavoriteTvAsync();
|
||||
SearchTv tvShow = tvShows.Results.Single(s => s.Id == IdHelper.BreakingBad);
|
||||
|
||||
Assert.NotNull(tvShow.GenreIds);
|
||||
Assert.True(tvShow.GenreIds.Any());
|
||||
await Verify(tvShow);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAccountGetMovieWatchlist()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteMoviesAsync(i));
|
||||
SearchMovie movie = (await TMDbClient.AccountGetFavoriteMoviesAsync()).Results[0];
|
||||
|
||||
// Requires that you have added at least one movie to your watchlist else this test will fail
|
||||
Assert.True(movie.Id > 0);
|
||||
Assert.NotNull(movie.Title);
|
||||
Assert.NotNull(movie.PosterPath);
|
||||
Assert.NotNull(movie.BackdropPath);
|
||||
Assert.NotNull(movie.OriginalTitle);
|
||||
Assert.NotNull(movie.Overview);
|
||||
Assert.NotNull(movie.OriginalLanguage);
|
||||
Assert.NotNull(movie.ReleaseDate);
|
||||
Assert.True(movie.VoteCount > 0);
|
||||
Assert.True(movie.VoteAverage > 0);
|
||||
Assert.True(movie.Popularity > 0);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetMovieWatchlistAsync(i));
|
||||
|
||||
Assert.NotNull(movie.GenreIds);
|
||||
Assert.True(movie.GenreIds.Any());
|
||||
SearchContainer<SearchMovie> watchlist = await TMDbClient.AccountGetMovieWatchlistAsync();
|
||||
SearchMovie movie = watchlist.Results.Single(s => s.Id == 100042);
|
||||
|
||||
await Verify(movie);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAccountGetTvWatchlist()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetTvWatchlistAsync(i));
|
||||
SearchTv tvShow = (await TMDbClient.AccountGetTvWatchlistAsync()).Results[0];
|
||||
|
||||
// Requires that you have added at least one movie to your watchlist else this test will fail
|
||||
Assert.True(tvShow.Id > 0);
|
||||
Assert.NotNull(tvShow.Name);
|
||||
Assert.NotNull(tvShow.PosterPath);
|
||||
Assert.NotNull(tvShow.BackdropPath);
|
||||
Assert.NotNull(tvShow.OriginalName);
|
||||
Assert.NotNull(tvShow.Overview);
|
||||
Assert.NotNull(tvShow.OriginalLanguage);
|
||||
Assert.NotNull(tvShow.FirstAirDate);
|
||||
Assert.True(tvShow.VoteCount > 0);
|
||||
Assert.True(tvShow.VoteAverage > 0);
|
||||
Assert.True(tvShow.Popularity > 0);
|
||||
SearchContainer<SearchTv> tvShows = await TMDbClient.AccountGetTvWatchlistAsync();
|
||||
SearchTv tvShow = tvShows.Results.Single(s => s.Id == 2691);
|
||||
|
||||
Assert.NotNull(tvShow.GenreIds);
|
||||
Assert.True(tvShow.GenreIds.Any());
|
||||
await Verify(tvShow);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAccountGetRatedMovies()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteMoviesAsync(i));
|
||||
SearchMovie movie = (await TMDbClient.AccountGetFavoriteMoviesAsync()).Results[0];
|
||||
|
||||
// Requires that you have rated at least one movie else this test will fail
|
||||
Assert.True(movie.Id > 0);
|
||||
Assert.NotNull(movie.Title);
|
||||
Assert.NotNull(movie.PosterPath);
|
||||
Assert.NotNull(movie.BackdropPath);
|
||||
Assert.NotNull(movie.OriginalTitle);
|
||||
Assert.NotNull(movie.Overview);
|
||||
Assert.NotNull(movie.OriginalLanguage);
|
||||
Assert.NotNull(movie.ReleaseDate);
|
||||
Assert.True(movie.VoteCount > 0);
|
||||
Assert.True(movie.VoteAverage > 0);
|
||||
Assert.True(movie.Popularity > 0);
|
||||
SearchContainer<SearchMovie> movies = await TMDbClient.AccountGetFavoriteMoviesAsync();
|
||||
SearchMovie movie = movies.Results.Single(s => s.Id == IdHelper.Avatar);
|
||||
|
||||
Assert.NotNull(movie.GenreIds);
|
||||
Assert.True(movie.GenreIds.Any());
|
||||
await Verify(movie);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAccountGetRatedTv()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetRatedTvShowsAsync(i));
|
||||
AccountSearchTv tvShow = (await TMDbClient.AccountGetRatedTvShowsAsync()).Results[0];
|
||||
|
||||
// Requires that you have rated at least one movie else this test will fail
|
||||
Assert.True(tvShow.Id > 0);
|
||||
Assert.NotNull(tvShow.Name);
|
||||
Assert.NotNull(tvShow.PosterPath);
|
||||
Assert.NotNull(tvShow.BackdropPath);
|
||||
Assert.NotNull(tvShow.OriginalName);
|
||||
Assert.NotNull(tvShow.Overview);
|
||||
Assert.NotNull(tvShow.OriginalLanguage);
|
||||
Assert.NotNull(tvShow.FirstAirDate);
|
||||
Assert.True(tvShow.VoteCount > 0);
|
||||
Assert.True(tvShow.VoteAverage > 0);
|
||||
Assert.True(tvShow.Popularity > 0);
|
||||
SearchContainer<AccountSearchTv> tvShows = await TMDbClient.AccountGetRatedTvShowsAsync();
|
||||
AccountSearchTv tvShow = tvShows.Results.Single(s => s.Id == IdHelper.BigBangTheory);
|
||||
|
||||
Assert.NotNull(tvShow.GenreIds);
|
||||
Assert.True(tvShow.GenreIds.Any());
|
||||
await Verify(tvShow);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -212,20 +143,13 @@ namespace TMDbLibTests
|
||||
{
|
||||
// TODO: Error in TMDb: https://www.themoviedb.org/talk/557f1af49251410a2c002480
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetRatedTvShowEpisodesAsync(i));
|
||||
AccountSearchTvEpisode tvEpisode = (await TMDbClient.AccountGetRatedTvShowEpisodesAsync()).Results[0];
|
||||
|
||||
// Requires that you have rated at least one movie else this test will fail
|
||||
Assert.True(tvEpisode.Id > 0);
|
||||
Assert.True(tvEpisode.ShowId > 0);
|
||||
Assert.True(tvEpisode.EpisodeNumber > 0);
|
||||
Assert.True(tvEpisode.SeasonNumber > 0);
|
||||
Assert.NotNull(tvEpisode.Name);
|
||||
Assert.NotNull(tvEpisode.AirDate);
|
||||
Assert.NotNull(tvEpisode.StillPath);
|
||||
Assert.True(tvEpisode.VoteCount > 0);
|
||||
Assert.True(tvEpisode.VoteAverage > 0);
|
||||
Assert.True(tvEpisode.Rating > 0);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetRatedTvShowEpisodesAsync(i));
|
||||
|
||||
SearchContainer<AccountSearchTvEpisode> tvEpisodes = await TMDbClient.AccountGetRatedTvShowEpisodesAsync();
|
||||
AccountSearchTvEpisode tvEpisode = tvEpisodes.Results.Single(s => s.Id == IdHelper.BreakingBadSeason1Episode1Id);
|
||||
|
||||
await Verify(tvEpisode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -351,7 +275,7 @@ namespace TMDbLibTests
|
||||
private async Task<bool> DoesListContainSpecificMovie(int movieId, Func<int, Task<IEnumerable<int>>> listGetter)
|
||||
{
|
||||
int page = 1;
|
||||
List<int> originalList = (await listGetter(1)).ToList();
|
||||
List<int> originalList = (await listGetter(page)).ToList();
|
||||
while (originalList != null && originalList.Any())
|
||||
{
|
||||
// Check if the current result page contains the relevant movie
|
||||
|
@ -13,40 +13,28 @@ namespace TMDbLibTests
|
||||
public async Task TestCertificationsListMovieAsync()
|
||||
{
|
||||
CertificationsContainer result = await TMDbClient.GetMovieCertificationsAsync();
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Certifications);
|
||||
Assert.True(result.Certifications.Count > 1);
|
||||
Assert.NotEmpty(result.Certifications);
|
||||
|
||||
List<CertificationItem> certAu = result.Certifications["AU"];
|
||||
Assert.NotNull(certAu);
|
||||
Assert.True(certAu.Count > 2);
|
||||
Assert.NotEmpty(certAu);
|
||||
|
||||
CertificationItem ratingE = certAu.Single(s => s.Certification == "E");
|
||||
|
||||
Assert.NotNull(ratingE);
|
||||
Assert.Equal("E", ratingE.Certification);
|
||||
Assert.Equal("Exempt from classification. Films that are exempt from classification must not contain contentious material (i.e. material that would ordinarily be rated M or higher).", ratingE.Meaning);
|
||||
Assert.Equal(1, ratingE.Order);
|
||||
await Verify(ratingE);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCertificationsListTvAsync()
|
||||
{
|
||||
CertificationsContainer result = await TMDbClient.GetTvCertificationsAsync();
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Certifications);
|
||||
Assert.True(result.Certifications.Count > 1);
|
||||
Assert.NotEmpty(result.Certifications);
|
||||
|
||||
List<CertificationItem> certUs = result.Certifications["US"];
|
||||
Assert.NotNull(certUs);
|
||||
Assert.True(certUs.Count > 2);
|
||||
Assert.NotEmpty(certUs);
|
||||
|
||||
CertificationItem ratingNr = certUs.SingleOrDefault(s => s.Certification == "NR");
|
||||
|
||||
Assert.NotNull(ratingNr);
|
||||
Assert.Equal("NR", ratingNr.Certification);
|
||||
Assert.Equal("No rating information.", ratingNr.Meaning);
|
||||
Assert.Equal(0, ratingNr.Order);
|
||||
|
||||
await Verify(ratingNr);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Changes;
|
||||
using TMDbLib.Objects.General;
|
||||
using Xunit;
|
||||
using TMDbLibTests.JsonHelpers;
|
||||
|
||||
namespace TMDbLibTests
|
||||
@ -13,128 +13,40 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestChangesMoviesAsync()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = await TMDbClient.GetChangesMoviesAsync();
|
||||
SearchContainer<ChangesListItem> page1 = await TMDbClient.GetMoviesChangesAsync(1);
|
||||
SearchContainer<ChangesListItem> oldChanges = await TMDbClient.GetMoviesChangesAsync(endDate: DateTime.UtcNow.AddMonths(-1));
|
||||
|
||||
Assert.NotNull(changesPage1);
|
||||
Assert.True(changesPage1.Results.Count > 0);
|
||||
Assert.True(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
Assert.Equal(1, changesPage1.Page);
|
||||
Assert.NotEmpty(page1.Results);
|
||||
Assert.NotEmpty(oldChanges.Results);
|
||||
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = await TMDbClient.GetChangesMoviesAsync(2);
|
||||
|
||||
Assert.NotNull(changesPage2);
|
||||
Assert.Equal(2, changesPage2.Page);
|
||||
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-7);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = await TMDbClient.GetChangesMoviesAsync(endDate: higher);
|
||||
|
||||
Assert.NotNull(changesMaxDate);
|
||||
Assert.Equal(1, changesMaxDate.Page);
|
||||
Assert.NotEqual(changesPage1.TotalResults, changesMaxDate.TotalResults);
|
||||
|
||||
// Check date range (lower)
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
|
||||
SearchContainer<ChangesListItem> changesLowDate = await TMDbClient.GetChangesMoviesAsync(startDate: lower);
|
||||
|
||||
Assert.NotNull(changesLowDate);
|
||||
Assert.Equal(1, changesLowDate.Page);
|
||||
Assert.NotEqual(changesPage1.TotalResults, changesLowDate.TotalResults);
|
||||
// At least one item must be newer in page1
|
||||
Assert.Contains(page1.Results, x => oldChanges.Results.All(s => s.Id != x.Id));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestChangesPeopleAsync()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = await TMDbClient.GetChangesPeopleAsync();
|
||||
SearchContainer<ChangesListItem> page1 = await TMDbClient.GetPeopleChangesAsync(1);
|
||||
SearchContainer<ChangesListItem> oldChanges = await TMDbClient.GetPeopleChangesAsync(endDate: DateTime.UtcNow.AddMonths(-1));
|
||||
|
||||
Assert.NotNull(changesPage1);
|
||||
Assert.True(changesPage1.Results.Count > 0);
|
||||
Assert.True(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
Assert.Equal(1, changesPage1.Page);
|
||||
Assert.NotEmpty(page1.Results);
|
||||
Assert.NotEmpty(oldChanges.Results);
|
||||
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = await TMDbClient.GetChangesPeopleAsync(2);
|
||||
|
||||
Assert.NotNull(changesPage2);
|
||||
Assert.Equal(2, changesPage2.Page);
|
||||
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-7);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = await TMDbClient.GetChangesPeopleAsync(endDate: higher);
|
||||
|
||||
Assert.NotNull(changesMaxDate);
|
||||
Assert.Equal(1, changesMaxDate.Page);
|
||||
Assert.NotEqual(changesPage1.TotalResults, changesMaxDate.TotalResults);
|
||||
|
||||
// Check date range (lower)
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
|
||||
SearchContainer<ChangesListItem> changesLowDate = await TMDbClient.GetChangesPeopleAsync(startDate: lower);
|
||||
|
||||
Assert.NotNull(changesLowDate);
|
||||
Assert.Equal(1, changesLowDate.Page);
|
||||
Assert.NotEqual(changesPage1.TotalResults, changesLowDate.TotalResults);
|
||||
|
||||
// None of the id's in changesLowDate should exist in changesMaxDate, and vice versa
|
||||
Assert.True(changesLowDate.Results.All(lowItem => changesMaxDate.Results.All(maxItem => maxItem.Id != lowItem.Id)));
|
||||
Assert.True(changesMaxDate.Results.All(maxItem => changesLowDate.Results.All(lowItem => maxItem.Id != lowItem.Id)));
|
||||
// At least one item must be newer in page1
|
||||
Assert.Contains(page1.Results, x => oldChanges.Results.All(s => s.Id != x.Id));
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task TestChangesTvShowsAsync()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = await TMDbClient.GetChangesTvAsync();
|
||||
SearchContainer<ChangesListItem> page1 = await TMDbClient.GetTvChangesAsync(1);
|
||||
SearchContainer<ChangesListItem> oldChanges = await TMDbClient.GetTvChangesAsync(endDate: DateTime.UtcNow.AddMonths(-1));
|
||||
|
||||
Assert.NotNull(changesPage1);
|
||||
Assert.NotNull(changesPage1.Results);
|
||||
Assert.True(changesPage1.Results.Count > 0);
|
||||
Assert.True(changesPage1.TotalResults >= changesPage1.Results.Count);
|
||||
Assert.Equal(1, changesPage1.Page);
|
||||
Assert.NotEmpty(page1.Results);
|
||||
Assert.NotEmpty(oldChanges.Results);
|
||||
|
||||
if (changesPage1.TotalPages > 1)
|
||||
{
|
||||
Assert.True(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = await TMDbClient.GetChangesTvAsync(2);
|
||||
|
||||
Assert.NotNull(changesPage2);
|
||||
Assert.Equal(2, changesPage2.Page);
|
||||
}
|
||||
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-8);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = await TMDbClient.GetChangesTvAsync(endDate: higher);
|
||||
|
||||
Assert.NotNull(changesMaxDate);
|
||||
Assert.Equal(1, changesMaxDate.Page);
|
||||
Assert.NotEqual(changesPage1.TotalResults, changesMaxDate.TotalResults);
|
||||
|
||||
// Check date range (lower)
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
|
||||
SearchContainer<ChangesListItem> changesLowDate = await TMDbClient.GetChangesTvAsync(startDate: lower);
|
||||
|
||||
Assert.NotNull(changesLowDate);
|
||||
Assert.Equal(1, changesLowDate.Page);
|
||||
Assert.NotEqual(changesPage1.TotalResults, changesLowDate.TotalResults);
|
||||
|
||||
// None of the id's in changesLowDate should exist in changesMaxDate, and vice versa
|
||||
foreach (ChangesListItem changeItem in changesLowDate.Results)
|
||||
{
|
||||
bool existsInOtherList = changesMaxDate.Results.Any(x => x.Id == changeItem.Id);
|
||||
|
||||
Assert.False(existsInOtherList, "Item id " + changeItem.Id + " is duplicated");
|
||||
}
|
||||
|
||||
foreach (ChangesListItem changeItem in changesMaxDate.Results)
|
||||
{
|
||||
bool existsInOtherList = changesLowDate.Results.Any(x => x.Id == changeItem.Id);
|
||||
|
||||
Assert.False(existsInOtherList, "Item id " + changeItem.Id + " is duplicated");
|
||||
}
|
||||
// At least one item must be newer in page1
|
||||
Assert.Contains(page1.Results, x => oldChanges.Results.All(s => s.Id != x.Id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,11 @@ namespace TMDbLibTests
|
||||
{
|
||||
public class ClientCollectionTests : TestBase
|
||||
{
|
||||
private static Dictionary<CollectionMethods, Func<Collection, object>> _methods;
|
||||
private static readonly Dictionary<CollectionMethods, Func<Collection, object>> Methods;
|
||||
|
||||
public ClientCollectionTests()
|
||||
static ClientCollectionTests()
|
||||
{
|
||||
_methods = new Dictionary<CollectionMethods, Func<Collection, object>>
|
||||
Methods = new Dictionary<CollectionMethods, Func<Collection, object>>
|
||||
{
|
||||
[CollectionMethods.Images] = collection => collection.Images
|
||||
};
|
||||
@ -24,18 +24,11 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCollectionsExtrasNone()
|
||||
{
|
||||
Collection collection = await TMDbClient.GetCollectionAsync(IdHelper.JamesBondCollection);
|
||||
|
||||
Assert.NotNull(collection);
|
||||
Assert.Equal("James Bond Collection", collection.Name);
|
||||
Assert.NotNull(collection.Parts);
|
||||
Assert.True(collection.Parts.Count > 0);
|
||||
Collection collection = await TMDbClient.GetCollectionAsync(IdHelper.BackToTheFutureCollection);
|
||||
|
||||
// Test all extras, ensure none of them exist
|
||||
foreach (Func<Collection, object> selector in _methods.Values)
|
||||
{
|
||||
foreach (Func<Collection, object> selector in Methods.Values)
|
||||
Assert.Null(selector(collection));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -49,41 +42,29 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCollectionsParts()
|
||||
{
|
||||
Collection collection = await TMDbClient.GetCollectionAsync(IdHelper.JamesBondCollection);
|
||||
Collection collection = await TMDbClient.GetCollectionAsync(IdHelper.BackToTheFutureCollection);
|
||||
|
||||
Assert.NotNull(collection);
|
||||
Assert.Equal("James Bond Collection", collection.Name);
|
||||
|
||||
Assert.NotNull(collection.Parts);
|
||||
Assert.True(collection.Parts.Count > 0);
|
||||
|
||||
Assert.Contains(collection.Parts, movie => movie.Title == "Live and Let Die");
|
||||
Assert.Contains(collection.Parts, movie => movie.Title == "Dr. No");
|
||||
await Verify(collection);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCollectionsExtrasExclusive()
|
||||
{
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetCollectionAsync(IdHelper.JamesBondCollection, extras));
|
||||
await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetCollectionAsync(IdHelper.BackToTheFutureCollection, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCollectionsExtrasAll()
|
||||
{
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetCollectionAsync(IdHelper.JamesBondCollection, combined));
|
||||
await TestMethodsHelper.TestGetAll(Methods, combined => TMDbClient.GetCollectionAsync(IdHelper.BackToTheFutureCollection, combined), async collection => await Verify(collection));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCollectionsImagesAsync()
|
||||
{
|
||||
// Get config
|
||||
await TMDbClient.GetConfigAsync();
|
||||
ImagesWithId images = await TMDbClient.GetCollectionImagesAsync(IdHelper.BackToTheFutureCollection);
|
||||
|
||||
// Test image url generator
|
||||
ImagesWithId images = await TMDbClient.GetCollectionImagesAsync(IdHelper.JamesBondCollection);
|
||||
|
||||
Assert.Equal(IdHelper.JamesBondCollection, images.Id);
|
||||
await TestImagesHelpers.TestImagesAsync(TestConfig, images);
|
||||
TestImagesHelpers.TestImagePaths(images);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Companies;
|
||||
@ -12,11 +13,11 @@ namespace TMDbLibTests
|
||||
{
|
||||
public class ClientCompanyTests : TestBase
|
||||
{
|
||||
private static Dictionary<CompanyMethods, Func<Company, object>> _methods;
|
||||
private static readonly Dictionary<CompanyMethods, Func<Company, object>> Methods;
|
||||
|
||||
public ClientCompanyTests()
|
||||
static ClientCompanyTests()
|
||||
{
|
||||
_methods = new Dictionary<CompanyMethods, Func<Company, object>>
|
||||
Methods = new Dictionary<CompanyMethods, Func<Company, object>>
|
||||
{
|
||||
[CompanyMethods.Movies] = company => company.Movies
|
||||
};
|
||||
@ -27,13 +28,8 @@ namespace TMDbLibTests
|
||||
{
|
||||
Company company = await TMDbClient.GetCompanyAsync(IdHelper.TwentiethCenturyFox);
|
||||
|
||||
Assert.NotNull(company);
|
||||
|
||||
// TODO: Test all properties
|
||||
Assert.Equal("20th Century Fox", company.Name);
|
||||
|
||||
// Test all extras, ensure none of them exist
|
||||
foreach (Func<Company, object> selector in _methods.Values)
|
||||
foreach (Func<Company, object> selector in Methods.Values)
|
||||
{
|
||||
Assert.Null(selector(company));
|
||||
}
|
||||
@ -42,13 +38,19 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCompaniesExtrasExclusive()
|
||||
{
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetCompanyAsync( IdHelper.TwentiethCenturyFox, extras));
|
||||
await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetCompanyAsync(IdHelper.TwentiethCenturyFox, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCompaniesExtrasAllAsync()
|
||||
{
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetCompanyAsync(IdHelper.TwentiethCenturyFox, combined));
|
||||
await TestMethodsHelper.TestGetAll(Methods, combined => TMDbClient.GetCompanyAsync(IdHelper.TwentiethCenturyFox, combined), async company =>
|
||||
{
|
||||
// Reduce testdata
|
||||
company.Movies.Results = company.Movies.Results.OrderBy(s => s.Id).Take(1).ToList();
|
||||
|
||||
await Verify(company, settings => settings.IgnoreProperty(nameof(company.Movies.TotalPages), nameof(company.Movies.TotalResults)));
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -60,20 +62,16 @@ namespace TMDbLibTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCompaniesGettersAsync()
|
||||
public async Task TestCompaniesMoviesAsync()
|
||||
{
|
||||
//GetCompanyMoviesAsync(int id, string language, int page = -1)
|
||||
SearchContainerWithId<SearchMovie> resp = await TMDbClient.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox);
|
||||
SearchContainerWithId<SearchMovie> respPage2 = await TMDbClient.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox, 2);
|
||||
SearchContainerWithId<SearchMovie> respItalian = await TMDbClient.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox, "it");
|
||||
|
||||
Assert.NotNull(resp);
|
||||
Assert.NotNull(respPage2);
|
||||
Assert.NotNull(respItalian);
|
||||
|
||||
Assert.True(resp.Results.Count > 0);
|
||||
Assert.True(respPage2.Results.Count > 0);
|
||||
Assert.True(respItalian.Results.Count > 0);
|
||||
Assert.NotEmpty(resp.Results);
|
||||
Assert.NotEmpty(respPage2.Results);
|
||||
Assert.NotEmpty(respItalian.Results);
|
||||
|
||||
bool allTitlesIdentical = true;
|
||||
for (int index = 0; index < resp.Results.Count; index++)
|
||||
@ -99,29 +97,11 @@ namespace TMDbLibTests
|
||||
Uri url = TMDbClient.GetImageUrl("original", company.LogoPath);
|
||||
Uri urlSecure = TMDbClient.GetImageUrl("original", company.LogoPath, true);
|
||||
|
||||
Assert.True(await TestHelpers.InternetUriExistsAsync(url));
|
||||
Assert.True(await TestHelpers.InternetUriExistsAsync(urlSecure));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCompaniesFullAsync()
|
||||
{
|
||||
Company company = await TMDbClient.GetCompanyAsync(IdHelper.ColumbiaPictures);
|
||||
|
||||
Assert.NotNull(company);
|
||||
|
||||
Assert.Equal(IdHelper.ColumbiaPictures, company.Id);
|
||||
Assert.Equal("Columbia Pictures Industries, Inc. (CPII) is an American film production and distribution company. Columbia Pictures now forms part of the Columbia TriStar Motion Picture Group, owned by Sony Pictures Entertainment, a subsidiary of the Japanese conglomerate Sony. It is one of the leading film companies in the world, a member of the so-called Big Six. It was one of the so-called Little Three among the eight major film studios of Hollywood's Golden Age.", company.Description);
|
||||
Assert.Equal("Culver City, California", company.Headquarters);
|
||||
Assert.Equal("http://www.sonypictures.com/", company.Homepage);
|
||||
Assert.Equal("US", company.OriginCountry);
|
||||
Assert.Equal("/mjUSfXXUhMiLAA1Zq1TfStNSoLR.png", company.LogoPath);
|
||||
Assert.Equal("Columbia Pictures", company.Name);
|
||||
|
||||
Assert.NotNull(company.ParentCompany);
|
||||
Assert.Equal(5752, company.ParentCompany.Id);
|
||||
Assert.Equal("/sFg00KK0vVq3oqvkCxRQWApYB83.png", company.ParentCompany.LogoPath);
|
||||
Assert.Equal("Sony Pictures Entertainment", company.ParentCompany.Name);
|
||||
await Verify(new
|
||||
{
|
||||
url,
|
||||
urlSecure
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -18,9 +18,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
APIConfiguration result = await TMDbClient.GetAPIConfiguration();
|
||||
|
||||
Assert.NotNull(result);
|
||||
|
||||
Assert.Contains(result.Images.BackdropSizes, c => c == "original");
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -28,9 +26,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
List<string> result = await TMDbClient.GetPrimaryTranslationsAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
|
||||
Assert.Contains(result, c => c == "da-DK");
|
||||
Assert.Contains("da-DK", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -38,10 +34,10 @@ namespace TMDbLibTests
|
||||
{
|
||||
List<Country> result = await TMDbClient.GetCountriesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result.Count > 200);
|
||||
Assert.NotEmpty(result);
|
||||
Country single = result.Single(s => s.EnglishName == "Denmark");
|
||||
|
||||
Assert.Contains(result, c => c.EnglishName == "Denmark" && c.Iso_3166_1 == "DK");
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -49,10 +45,10 @@ namespace TMDbLibTests
|
||||
{
|
||||
List<Language> result = await TMDbClient.GetLanguagesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result.Count > 180);
|
||||
Assert.NotEmpty(result);
|
||||
Language single = result.Single(s => s.Name == "Dansk");
|
||||
|
||||
Assert.Contains(result, l => l.Name == "Dansk" && l.EnglishName == "Danish" && l.Iso_639_1 == "da");
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -60,13 +56,10 @@ namespace TMDbLibTests
|
||||
{
|
||||
Timezones result = await TMDbClient.GetTimezonesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result.List.Count > 200);
|
||||
Assert.NotEmpty(result.List);
|
||||
List<string> single = result.List["DK"];
|
||||
|
||||
List<string> item = result.List["DK"];
|
||||
Assert.NotNull(item);
|
||||
Assert.Single(item);
|
||||
Assert.Equal("Europe/Copenhagen", item[0]);
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -74,12 +67,10 @@ namespace TMDbLibTests
|
||||
{
|
||||
List<Job> jobs = await TMDbClient.GetJobsAsync();
|
||||
|
||||
Assert.NotNull(jobs);
|
||||
Assert.True(jobs.Count > 0);
|
||||
Assert.NotEmpty(jobs);
|
||||
Job single = jobs.Single(s => s.Department == "Writing");
|
||||
|
||||
Assert.True(jobs.All(job => !string.IsNullOrEmpty(job.Department)));
|
||||
Assert.True(jobs.All(job => job.Jobs != null));
|
||||
Assert.True(jobs.All(job => job.Jobs.Count > 0));
|
||||
await Verify(single);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Credit;
|
||||
using TMDbLib.Objects.General;
|
||||
using TMDbLibTests.Helpers;
|
||||
using TMDbLibTests.JsonHelpers;
|
||||
|
||||
@ -16,22 +13,10 @@ namespace TMDbLibTests
|
||||
{
|
||||
Credit result = await TMDbClient.GetCreditsAsync(IdHelper.BruceWillisMiamiVice);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(CreditType.Cast, result.CreditType);
|
||||
Assert.Equal("Actors", result.Department);
|
||||
Assert.Equal("Actor", result.Job);
|
||||
Assert.Equal(MediaType.Tv, result.MediaType);
|
||||
Assert.Equal(IdHelper.BruceWillisMiamiVice, result.Id);
|
||||
// Episode must exist
|
||||
Assert.Contains(result.Media.Episodes, s => s.Name == "No Exit");
|
||||
|
||||
Assert.NotNull(result.Person);
|
||||
Assert.Equal("Bruce Willis", result.Person.Name);
|
||||
Assert.Equal(62, result.Person.Id);
|
||||
|
||||
Assert.NotNull(result.Media);
|
||||
Assert.Equal(1908, result.Media.Id);
|
||||
Assert.Equal("Miami Vice", result.Media.Name);
|
||||
Assert.Equal("Miami Vice", result.Media.OriginalName);
|
||||
Assert.Equal("", result.Media.Character);
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -42,41 +27,15 @@ namespace TMDbLibTests
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestGetCreditEpisode()
|
||||
{
|
||||
Credit result = await TMDbClient.GetCreditsAsync(IdHelper.BruceWillisMiamiVice);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Media);
|
||||
Assert.NotNull(result.Media.Episodes);
|
||||
|
||||
CreditEpisode item = result.Media.Episodes.SingleOrDefault(s => s.Name == "No Exit");
|
||||
Assert.NotNull(item);
|
||||
|
||||
Assert.Equal(new DateTime(1984, 11, 9), item.AirDate);
|
||||
Assert.Equal(8, item.EpisodeNumber);
|
||||
Assert.Equal("No Exit", item.Name);
|
||||
Assert.Equal("Crockett attempts to help an old flame free herself from a racketeer, then is framed for taking bribes. Martin Castillo becomes the squad's new Lieutenant.", item.Overview);
|
||||
Assert.Equal(1, item.SeasonNumber);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.StillPath), "item.StillPath was not a valid image path, was: " + item.StillPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestGetCreditSeasons()
|
||||
{
|
||||
Credit result = await TMDbClient.GetCreditsAsync(IdHelper.HughLaurieHouse);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Media);
|
||||
Assert.NotNull(result.Media.Seasons);
|
||||
// Season must exist
|
||||
Assert.Contains(result.Media.Seasons, s => s.SeasonNumber == 1);
|
||||
|
||||
CreditSeason item = result.Media.Seasons.SingleOrDefault(s => s.SeasonNumber == 1);
|
||||
Assert.NotNull(item);
|
||||
|
||||
Assert.Equal(new DateTime(2004, 11, 16), item.AirDate);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.PosterPath), "item.PosterPath was not a valid image path, was: " + item.PosterPath);
|
||||
Assert.Equal(1, item.SeasonNumber);
|
||||
await Verify(result);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Discover;
|
||||
using TMDbLib.Objects.General;
|
||||
using System.Linq;
|
||||
using TMDbLib.Objects.Search;
|
||||
using TMDbLibTests.Helpers;
|
||||
using TMDbLibTests.JsonHelpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TMDbLibTests
|
||||
@ -17,13 +15,12 @@ namespace TMDbLibTests
|
||||
public async Task TestDiscoverTvShowsNoParamsAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.DiscoverTvShowsAsync().Query(i));
|
||||
}
|
||||
|
||||
SearchContainer<SearchTv> result = await TMDbClient.DiscoverTvShowsAsync().Query();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(1, result.Page);
|
||||
Assert.NotNull(result.Results);
|
||||
Assert.True(result.Results.Any());
|
||||
[Fact]
|
||||
public async Task TestDiscoverMoviesNoParamsAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.DiscoverMoviesAsync().Query(i));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -36,19 +33,6 @@ namespace TMDbLibTests
|
||||
await TestHelpers.SearchPagesAsync(i => query.Query(i));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestDiscoverMoviesNoParamsAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.DiscoverMoviesAsync().Query(i));
|
||||
|
||||
SearchContainer<SearchMovie> result = await TMDbClient.DiscoverMoviesAsync().Query();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(1, result.Page);
|
||||
Assert.NotNull(result.Results);
|
||||
Assert.True(result.Results.Any());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestDiscoverMoviesAsync()
|
||||
{
|
||||
@ -62,7 +46,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestDiscoverMoviesRegionAsync()
|
||||
{
|
||||
DiscoverMovie query = TMDbClient.DiscoverMoviesAsync().WhereReleaseDateIsInRegion("BR").WherePrimaryReleaseDateIsAfter(new DateTime(2017, 01, 01));
|
||||
DiscoverMovie query = TMDbClient.DiscoverMoviesAsync()
|
||||
.WhereReleaseDateIsInRegion("BR")
|
||||
.WherePrimaryReleaseDateIsAfter(new DateTime(2017, 01, 01));
|
||||
|
||||
await TestHelpers.SearchPagesAsync(i => query.Query(i));
|
||||
}
|
||||
@ -70,23 +56,28 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestDiscoverMoviesLanguageAsync()
|
||||
{
|
||||
DiscoverMovie query = TMDbClient.DiscoverMoviesAsync().WhereLanguageIs("da-DK").WherePrimaryReleaseDateIsAfter(new DateTime(2017, 01, 01));
|
||||
SearchContainer<SearchMovie> query = await TMDbClient.DiscoverMoviesAsync()
|
||||
.WhereOriginalLanguageIs("en-US")
|
||||
.WherePrimaryReleaseDateIsAfter(new DateTime(2017, 01, 01))
|
||||
.Query();
|
||||
|
||||
Assert.Equal("Skønheden og Udyret", (await query.Query(0)).Results[11].Title);
|
||||
SearchContainer<SearchMovie> queryDanish = await TMDbClient.DiscoverMoviesAsync()
|
||||
.WhereLanguageIs("da-DK")
|
||||
.WhereOriginalLanguageIs("en-US")
|
||||
.WherePrimaryReleaseDateIsAfter(new DateTime(2017, 01, 01))
|
||||
.Query();
|
||||
|
||||
await TestHelpers.SearchPagesAsync(i => query.Query(i));
|
||||
}
|
||||
// Should be the same identities, but different titles
|
||||
Assert.Equal(query.TotalResults, queryDanish.TotalResults);
|
||||
|
||||
[Theory]
|
||||
[InlineData("ko")]
|
||||
[InlineData("zh")]
|
||||
public async Task TestDiscoverMoviesOriginalLanguage(string language)
|
||||
{
|
||||
DiscoverMovie query = TMDbClient.DiscoverMoviesAsync().WhereOriginalLanguageIs(language);
|
||||
List<SearchMovie> results = (await query.Query(0)).Results;
|
||||
for (int i = 0; i < query.Results.Count; i++)
|
||||
{
|
||||
SearchMovie a = query.Results[i];
|
||||
SearchMovie b = queryDanish.Results[i];
|
||||
|
||||
Assert.NotEmpty(results);
|
||||
Assert.All(results, item => Assert.Contains(language, item.OriginalLanguage));
|
||||
Assert.Equal(a.Id, b.Id);
|
||||
Assert.NotEqual(a.Title, b.Title);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,53 +9,51 @@ namespace TMDbLibTests
|
||||
public class ClientFindTests : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void TestFindImdbMovie()
|
||||
public async Task TestFindImdbMovie()
|
||||
{
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbTerminatorId);
|
||||
Assert.Single(result.Result.MovieResults);
|
||||
Assert.Equal(IdHelper.TmdbTerminatorId, result.Result.MovieResults[0].Id);
|
||||
FindContainer result = await TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbTerminatorId);
|
||||
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFindImdbPerson()
|
||||
public async Task TestFindImdbPerson()
|
||||
{
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBruceWillis);
|
||||
Assert.Single(result.Result.PersonResults);
|
||||
Assert.Equal(IdHelper.BruceWillis, result.Result.PersonResults[0].Id);
|
||||
FindContainer result = await TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBruceWillis);
|
||||
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFindImdbTvShowEpisode()
|
||||
public async Task TestFindImdbTvShowEpisode()
|
||||
{
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadSeason1Episode1Id);
|
||||
Assert.Single(result.Result.TvEpisode);
|
||||
Assert.Equal(IdHelper.BreakingBadSeason1Episode1Id, result.Result.TvEpisode[0].Id);
|
||||
FindContainer result = await TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadSeason1Episode1Id);
|
||||
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFindImdbTvShowSeason()
|
||||
public async Task TestFindImdbTvShowSeasonAsync()
|
||||
{
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadSeason1Id);
|
||||
Assert.Single(result.Result.TvEpisode);
|
||||
|
||||
Assert.Single(result.Result.TvSeason);
|
||||
Assert.Equal(IdHelper.BreakingBadSeason1Id, result.Result.TvSeason[0].Id);
|
||||
FindContainer result = await TMDbClient.FindAsync(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadSeason1Id);
|
||||
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFindTvdbTvShow()
|
||||
public async Task TestFindTvdbTvShowAsync()
|
||||
{
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadId);
|
||||
Assert.Single(result.Result.TvResults);
|
||||
Assert.Equal(IdHelper.TmdbBreakingBadId, result.Result.TvResults[0].Id);
|
||||
FindContainer result = await TMDbClient.FindAsync(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadId);
|
||||
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestFindImdbTvShow()
|
||||
public async Task TestFindImdbTvShowAsync()
|
||||
{
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadId);
|
||||
Assert.Single(result.Result.TvResults);
|
||||
Assert.Equal(IdHelper.TmdbBreakingBadId, result.Result.TvResults[0].Id);
|
||||
FindContainer result = await TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadId);
|
||||
|
||||
await Verify(result);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.General;
|
||||
using TMDbLib.Objects.Search;
|
||||
using TMDbLibTests.Helpers;
|
||||
using TMDbLibTests.JsonHelpers;
|
||||
|
||||
namespace TMDbLibTests
|
||||
@ -16,19 +17,20 @@ namespace TMDbLibTests
|
||||
// Default language
|
||||
List<Genre> genres = await TMDbClient.GetTvGenresAsync();
|
||||
|
||||
Assert.NotNull(genres);
|
||||
Assert.True(genres.Count > 0);
|
||||
|
||||
// Another language
|
||||
List<Genre> genresDanish = await TMDbClient.GetTvGenresAsync("da");
|
||||
|
||||
Assert.NotNull(genresDanish);
|
||||
Assert.True(genresDanish.Count > 0);
|
||||
|
||||
Assert.Equal(genres.Count, genresDanish.Count);
|
||||
await Verify(new
|
||||
{
|
||||
genres,
|
||||
genresDanish
|
||||
});
|
||||
|
||||
// At least one should be different
|
||||
Assert.Contains(genres, genre => genresDanish.First(danishGenre => danishGenre.Id == genre.Id).Name != genre.Name);
|
||||
Genre actionEn = genres.Single(s => s.Id == IdHelper.ActionAdventureTvGenre);
|
||||
Genre actionDa = genresDanish.Single(s => s.Id == IdHelper.ActionAdventureTvGenre);
|
||||
|
||||
Assert.NotEqual(actionEn.Name, actionDa.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -37,46 +39,30 @@ namespace TMDbLibTests
|
||||
// Default language
|
||||
List<Genre> genres = await TMDbClient.GetMovieGenresAsync();
|
||||
|
||||
Assert.NotNull(genres);
|
||||
Assert.True(genres.Count > 0);
|
||||
|
||||
// Another language
|
||||
List<Genre> genresDanish = await TMDbClient.GetMovieGenresAsync("da");
|
||||
|
||||
Assert.NotNull(genresDanish);
|
||||
Assert.True(genresDanish.Count > 0);
|
||||
|
||||
Assert.Equal(genres.Count, genresDanish.Count);
|
||||
await Verify(new
|
||||
{
|
||||
genres,
|
||||
genresDanish
|
||||
});
|
||||
|
||||
// At least one should be different
|
||||
Assert.Contains(genres, genre => genresDanish.First(danishGenre => danishGenre.Id == genre.Id).Name != genre.Name);
|
||||
Genre actionEn = genres.Single(s => s.Id == IdHelper.AdventureMovieGenre);
|
||||
Genre actionDa = genresDanish.Single(s => s.Id == IdHelper.AdventureMovieGenre);
|
||||
|
||||
Assert.NotEqual(actionEn.Name, actionDa.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestGenreMoviesAsync()
|
||||
{
|
||||
// Get first genre
|
||||
Genre genre = (await TMDbClient.GetMovieGenresAsync()).First();
|
||||
SearchContainerWithId<SearchMovie> movies = await TMDbClient.GetGenreMoviesAsync(IdHelper.AdventureMovieGenre);
|
||||
|
||||
// Get movies
|
||||
SearchContainerWithId<SearchMovie> movies = await TMDbClient.GetGenreMoviesAsync(genre.Id);
|
||||
SearchContainerWithId<SearchMovie> moviesPage2 = await TMDbClient.GetGenreMoviesAsync(genre.Id, "it", 2, includeAllMovies: false);
|
||||
SearchContainerWithId<SearchMovie> moviesAll = await TMDbClient.GetGenreMoviesAsync(genre.Id, includeAllMovies: true);
|
||||
|
||||
Assert.Equal(1, movies.Page);
|
||||
Assert.Equal(2, moviesPage2.Page);
|
||||
Assert.Equal(1, moviesAll.Page);
|
||||
|
||||
Assert.True(movies.Results.Count > 0);
|
||||
Assert.True(moviesPage2.Results.Count > 0);
|
||||
Assert.True(moviesAll.Results.Count > 0);
|
||||
|
||||
Assert.True(movies.Results.All(s => s != null));
|
||||
Assert.True(moviesPage2.Results.All(s => s != null));
|
||||
Assert.True(moviesAll.Results.All(s => s != null));
|
||||
|
||||
Assert.Equal(movies.TotalResults, moviesPage2.TotalResults); // Should be the same, despite the use of 'includeAllMovies' and Italian
|
||||
Assert.True(moviesAll.TotalResults >= movies.TotalResults);
|
||||
Assert.NotEmpty(movies.Results);
|
||||
Assert.Equal(IdHelper.AdventureMovieGenre, movies.Id);
|
||||
Assert.All(movies.Results, x => Assert.Contains(IdHelper.AdventureMovieGenre, x.GenreIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Authentication;
|
||||
using TMDbLib.Objects.General;
|
||||
@ -19,41 +16,21 @@ namespace TMDbLibTests
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Try changing the rating
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 7.5));
|
||||
await TestMethodsHelper.SetValidateRemoveTest(async () =>
|
||||
{
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 7.5));
|
||||
}, async () =>
|
||||
{
|
||||
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
|
||||
}, async shouldBeSet =>
|
||||
{
|
||||
SearchContainer<TvEpisodeWithRating> ratings = await TMDbClient.GetGuestSessionRatedTvEpisodesAsync();
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
SearchContainer<TvEpisodeWithRating> ratings = await TMDbClient.GetGuestSessionRatedTvEpisodesAsync();
|
||||
|
||||
Assert.False(true, "This test has been failing for some time - TMDb has been made aware, but have not responded");
|
||||
|
||||
//double tmpRating = ratings.Results.Single(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1).Rating;
|
||||
//Assert.True(ratings.Results.Any(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1));
|
||||
//Assert.True(Math.Abs(7.5 - tmpRating) < float.Epsilon);
|
||||
|
||||
//// Try changing it back to the previous rating
|
||||
//Assert.True(Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 8));
|
||||
|
||||
//// Allow TMDb to cache our changes
|
||||
//await Task.Delay(2000);
|
||||
|
||||
//ratings = Config.Client.GetGuestSessionRatedTvEpisodesAsync().Sync();
|
||||
|
||||
//tmpRating = ratings.Results.Single(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1).Rating;
|
||||
//Assert.True(ratings.Results.Any(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1));
|
||||
//Assert.True(Math.Abs(8 - tmpRating) < float.Epsilon);
|
||||
|
||||
//// Try removing the rating
|
||||
//Assert.True(Config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
|
||||
|
||||
//// Allow TMDb to cache our changes
|
||||
//await Task.Delay(2000);
|
||||
|
||||
//ratings = Config.Client.GetGuestSessionRatedTvEpisodesAsync().Sync();
|
||||
|
||||
//Assert.False(ratings.Results.Any(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1));
|
||||
if (shouldBeSet)
|
||||
Assert.Contains(ratings.Results, x => x.ShowId == IdHelper.BreakingBad && x.SeasonNumber == 1 && x.EpisodeNumber == 1);
|
||||
else
|
||||
Assert.DoesNotContain(ratings.Results, x => x.ShowId == IdHelper.BreakingBad && x.SeasonNumber == 1 && x.EpisodeNumber == 1);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -61,133 +38,43 @@ namespace TMDbLibTests
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Try changing the rating
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.House, 7.5));
|
||||
await TestMethodsHelper.SetValidateRemoveTest(async () =>
|
||||
{
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.House, 7.5));
|
||||
}, async () =>
|
||||
{
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.House));
|
||||
}, async shouldBeSet =>
|
||||
{
|
||||
SearchContainer<SearchTvShowWithRating> ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
SearchContainer<SearchTvShowWithRating> ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
|
||||
|
||||
double tmpRating = ratings.Results.Single(s => s.Id == IdHelper.House).Rating;
|
||||
Assert.Contains(ratings.Results, s => s.Id == IdHelper.House);
|
||||
Assert.True(Math.Abs(7.5 - tmpRating) < float.Epsilon);
|
||||
|
||||
// Try changing it back to the previous rating
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.House, 8));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
|
||||
|
||||
tmpRating = ratings.Results.Single(s => s.Id == IdHelper.House).Rating;
|
||||
Assert.Contains(ratings.Results, s => s.Id == IdHelper.House);
|
||||
Assert.True(Math.Abs(8 - tmpRating) < float.Epsilon);
|
||||
|
||||
// Try removing the rating
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.House));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
|
||||
|
||||
Assert.DoesNotContain(ratings.Results, s => s.Id == IdHelper.House);
|
||||
if (shouldBeSet)
|
||||
Assert.Contains(ratings.Results, x => x.Id == IdHelper.House);
|
||||
else
|
||||
Assert.DoesNotContain(ratings.Results, x => x.Id == IdHelper.House);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingGuestSessionAsync()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
await TestMethodsHelper.SetValidateRemoveTest(async () =>
|
||||
{
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 7.5));
|
||||
}, async () =>
|
||||
{
|
||||
Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.Terminator));
|
||||
}, async shouldBeSet =>
|
||||
{
|
||||
SearchContainer<SearchMovieWithRating> ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();
|
||||
|
||||
// Try changing the rating
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 7.5));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
SearchContainer<SearchMovieWithRating> ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();
|
||||
|
||||
double tmpRating = ratings.Results.Single(s => s.Id == IdHelper.Terminator).Rating;
|
||||
Assert.Contains(ratings.Results, s => s.Id == IdHelper.Terminator);
|
||||
Assert.True(Math.Abs(7.5 - tmpRating) < float.Epsilon);
|
||||
|
||||
// Try changing it back to the previous rating
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 8));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();
|
||||
|
||||
tmpRating = ratings.Results.Single(s => s.Id == IdHelper.Terminator).Rating;
|
||||
Assert.Contains(ratings.Results, s => s.Id == IdHelper.Terminator);
|
||||
Assert.True(Math.Abs(8 - tmpRating) < float.Epsilon);
|
||||
|
||||
// Try removing the rating
|
||||
Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.Terminator));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();
|
||||
|
||||
Assert.DoesNotContain(ratings.Results, s => s.Id == IdHelper.Terminator);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestGuestSessionGetRatedTvEpisodesAsync()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Ensure we have a rating
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 7.5));
|
||||
|
||||
// Test paging
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetGuestSessionRatedTvEpisodesAsync(i));
|
||||
|
||||
// Fetch ratings
|
||||
SearchContainer<TvEpisodeWithRating> result = await TMDbClient.GetGuestSessionRatedTvEpisodesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestGuestSessionGetRatedTvAsync()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Ensure we have a rating
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.BigBangTheory, 7.5));
|
||||
|
||||
// Test paging
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetGuestSessionRatedTvAsync(i));
|
||||
|
||||
// Fetch ratings
|
||||
SearchContainer<SearchTvShowWithRating> result = await TMDbClient.GetGuestSessionRatedTvAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestGuestSessionGetRatedMoviesAsync()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Ensure we have a rating
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 7.5));
|
||||
|
||||
// Test paging
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetGuestSessionRatedMoviesAsync(i));
|
||||
|
||||
// Fetch ratings
|
||||
SearchContainer<SearchMovieWithRating> result = await TMDbClient.GetGuestSessionRatedMoviesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
if (shouldBeSet)
|
||||
Assert.Contains(ratings.Results, x => x.Id == IdHelper.Terminator);
|
||||
else
|
||||
Assert.DoesNotContain(ratings.Results, x => x.Id == IdHelper.Terminator);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -12,24 +12,27 @@ namespace TMDbLibTests
|
||||
public class ClientKeywordTests : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public async Task TestKeywordGet()
|
||||
public async Task TestGetMovieKeywordsAsync()
|
||||
{
|
||||
KeywordsContainer keywords = await TMDbClient.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.NotNull(keywords);
|
||||
Assert.NotNull(keywords.Keywords);
|
||||
Assert.True(keywords.Keywords.Count > 0);
|
||||
await Verify(keywords);
|
||||
}
|
||||
|
||||
// Try to get all keywords
|
||||
foreach (Keyword testKeyword in keywords.Keywords)
|
||||
{
|
||||
Keyword getKeyword = await TMDbClient.GetKeywordAsync(testKeyword.Id);
|
||||
[Fact]
|
||||
public async Task TestGetTvShowKeywordsAsync()
|
||||
{
|
||||
ResultContainer<Keyword> keywords = await TMDbClient.GetTvShowKeywordsAsync(IdHelper.BigBangTheory);
|
||||
|
||||
Assert.NotNull(getKeyword);
|
||||
await Verify(keywords);
|
||||
}
|
||||
|
||||
Assert.Equal(testKeyword.Id, getKeyword.Id);
|
||||
Assert.Equal(testKeyword.Name, getKeyword.Name);
|
||||
}
|
||||
[Fact]
|
||||
public async Task TestKeywordGetSingle()
|
||||
{
|
||||
Keyword keyword = await TMDbClient.GetKeywordAsync(IdHelper.AgentKeyword);
|
||||
|
||||
await Verify(keyword);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -43,52 +46,14 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestKeywordMovies()
|
||||
{
|
||||
KeywordsContainer keywords = await TMDbClient.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard);
|
||||
SearchContainerWithId<SearchMovie> movies = await TMDbClient.GetKeywordMoviesAsync(IdHelper.AgentKeyword);
|
||||
|
||||
Assert.NotNull(keywords);
|
||||
Assert.NotNull(keywords.Keywords);
|
||||
Assert.True(keywords.Keywords.Count > 0);
|
||||
Assert.Equal(IdHelper.AgentKeyword, movies.Id);
|
||||
Assert.NotEmpty(movies.Results);
|
||||
|
||||
// Get first keyword
|
||||
Keyword testKeyword = keywords.Keywords.First();
|
||||
KeywordsContainer movie = await TMDbClient.GetMovieKeywordsAsync(movies.Results.First().Id);
|
||||
|
||||
// Get movies
|
||||
SearchContainerWithId<SearchMovie> movies = await TMDbClient.GetKeywordMoviesAsync(testKeyword.Id);
|
||||
SearchContainerWithId<SearchMovie> moviesItalian = await TMDbClient.GetKeywordMoviesAsync(testKeyword.Id, "it");
|
||||
SearchContainerWithId<SearchMovie> moviesPage2 = await TMDbClient.GetKeywordMoviesAsync(testKeyword.Id, 2);
|
||||
|
||||
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.Empty(moviesPage2.Results);
|
||||
|
||||
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);
|
||||
Assert.Contains(movie.Keywords, x => IdHelper.AgentKeyword == x.Id);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +1,39 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TMDbLib.Client;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Authentication;
|
||||
using TMDbLib.Objects.General;
|
||||
using TMDbLib.Objects.Lists;
|
||||
using TMDbLib.Objects.Movies;
|
||||
using TMDbLib.Objects.Search;
|
||||
using TMDbLibTests.Helpers;
|
||||
using TMDbLibTests.JsonHelpers;
|
||||
|
||||
namespace TMDbLibTests
|
||||
{
|
||||
[Collection(nameof(ListFixturesCollection))]
|
||||
public class ClientListsTests : TestBase
|
||||
{
|
||||
private const string TestListId = "528349d419c2954bd21ca0a8";
|
||||
private const string EphemeralListPrefix = "TestListTMDbLib-";
|
||||
|
||||
[Fact]
|
||||
public async Task TestListAsync()
|
||||
public async Task TestGetListAsync()
|
||||
{
|
||||
// Get list
|
||||
GenericList list = await TMDbClient.GetListAsync(TestListId);
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.Equal(TestListId, list.Id);
|
||||
Assert.Equal(list.ItemCount, list.Items.Count);
|
||||
await Verify(list);
|
||||
}
|
||||
|
||||
foreach (SearchMovie movieResult in list.Items)
|
||||
{
|
||||
Assert.NotNull(movieResult);
|
||||
[Fact]
|
||||
public async Task TestListAsync()
|
||||
{
|
||||
SearchContainer<ListResult> movieLists = await TMDbClient.GetMovieListsAsync(IdHelper.Avatar);
|
||||
|
||||
// Ensure all movies point to this list
|
||||
int page = 1;
|
||||
SearchContainer<ListResult> movieLists = await TMDbClient.GetMovieListsAsync(movieResult.Id);
|
||||
while (movieLists != null)
|
||||
{
|
||||
// Check if the current result page contains the relevant list
|
||||
if (movieLists.Results.Any(s => s.Id == TestListId))
|
||||
{
|
||||
movieLists = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
// See if there is an other page we could try, if not the test fails
|
||||
if (movieLists.Page < movieLists.TotalPages)
|
||||
movieLists = await TMDbClient.GetMovieListsAsync(movieResult.Id, ++page);
|
||||
else
|
||||
throw new Exception($"Movie '{movieResult.Title}' was not linked to the test list");
|
||||
}
|
||||
}
|
||||
Assert.NotEmpty(movieLists.Results);
|
||||
Assert.All(movieLists.Results, x => Assert.Equal(MediaType.Movie, x.ListType));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -60,44 +45,38 @@ namespace TMDbLibTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestListIsMoviePresentFailureAsync()
|
||||
public async Task TestListCreateAddClearAndDeleteAsync()
|
||||
{
|
||||
Assert.False(await TMDbClient.GetListIsMoviePresentAsync(TestListId, IdHelper.Terminator));
|
||||
string listName = EphemeralListPrefix + DateTime.UtcNow.ToString("O");
|
||||
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Clear list
|
||||
Assert.True(await TMDbClient.ListClearAsync(TestListId));
|
||||
string listId = await TMDbClient.ListCreateAsync(listName);
|
||||
|
||||
// Verify Avatar is not present
|
||||
Assert.False(await TMDbClient.GetListIsMoviePresentAsync(TestListId, IdHelper.Avatar));
|
||||
Assert.False(string.IsNullOrWhiteSpace(listId));
|
||||
|
||||
// Add Avatar
|
||||
Assert.True(await TMDbClient.ListAddMovieAsync(TestListId, IdHelper.Avatar));
|
||||
GenericList newlyAddedList = await TMDbClient.GetListAsync(listId);
|
||||
|
||||
// Verify Avatar is present
|
||||
Assert.True(await TMDbClient.GetListIsMoviePresentAsync(TestListId, IdHelper.Avatar));
|
||||
}
|
||||
await Verify(newlyAddedList, settings => settings.IgnoreProperty<GenericList>(x => x.Id, x => x.Name));
|
||||
|
||||
[Fact]
|
||||
public async Task TestListCreateAndDeleteAsync()
|
||||
{
|
||||
const string listName = "Test List 123";
|
||||
// Add a movie
|
||||
await TMDbClient.ListAddMovieAsync(listId, IdHelper.Avatar);
|
||||
await TMDbClient.ListAddMovieAsync(listId, IdHelper.AGoodDayToDieHard);
|
||||
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
string newListId = await TMDbClient.ListCreateAsync(listName);
|
||||
Assert.True(await TMDbClient.GetListIsMoviePresentAsync(listId, IdHelper.Avatar));
|
||||
|
||||
Assert.False(string.IsNullOrWhiteSpace(newListId));
|
||||
// Remove a movie
|
||||
await TMDbClient.ListRemoveMovieAsync(listId, IdHelper.Avatar);
|
||||
|
||||
GenericList newlyAddedList = await TMDbClient.GetListAsync(newListId);
|
||||
Assert.NotNull(newlyAddedList);
|
||||
Assert.Equal(listName, newlyAddedList.Name);
|
||||
Assert.Equal("", newlyAddedList.Description); // "" is the default value
|
||||
Assert.Equal("en", newlyAddedList.Iso_639_1); // en is the default value
|
||||
Assert.Equal(0, newlyAddedList.ItemCount);
|
||||
Assert.Empty(newlyAddedList.Items);
|
||||
Assert.False(string.IsNullOrWhiteSpace(newlyAddedList.CreatedBy));
|
||||
Assert.False(await TMDbClient.GetListIsMoviePresentAsync(listId, IdHelper.Avatar));
|
||||
|
||||
Assert.True(await TMDbClient.ListDeleteAsync(newListId));
|
||||
// Clear the list
|
||||
await TMDbClient.ListClearAsync(listId);
|
||||
|
||||
Assert.False(await TMDbClient.GetListIsMoviePresentAsync(listId, IdHelper.AGoodDayToDieHard));
|
||||
|
||||
// Delete the list
|
||||
Assert.True(await TMDbClient.ListDeleteAsync(listId));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -106,50 +85,35 @@ namespace TMDbLibTests
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Try removing a list with an incorrect id
|
||||
Assert.False(await TMDbClient.ListDeleteAsync("bla"));
|
||||
Assert.False(await TMDbClient.ListDeleteAsync("invalid_id"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestListAddAndRemoveMovieAsync()
|
||||
private class ListCleanupFixture : IDisposable
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
public void Dispose()
|
||||
{
|
||||
TestConfig config = new TestConfig();
|
||||
TMDbClient client = config.Client;
|
||||
|
||||
// Add a new movie to the list
|
||||
Assert.True(await TMDbClient.ListAddMovieAsync(TestListId, IdHelper.EvanAlmighty));
|
||||
client.SetSessionInformationAsync(config.UserSessionId, SessionType.UserSession).GetAwaiter().GetResult();
|
||||
|
||||
// Try again, this time it should fail since the list already contains this movie
|
||||
Assert.False(await TMDbClient.ListAddMovieAsync(TestListId, IdHelper.EvanAlmighty));
|
||||
// Yes, this is only the first page, but that's fine.
|
||||
// Eventually we'll delete all remaining lists
|
||||
SearchContainer<AccountList> lists = client.AccountGetListsAsync().GetAwaiter().GetResult();
|
||||
|
||||
// Get list and check if the item was added
|
||||
GenericList listAfterAdd = await TMDbClient.GetListAsync(TestListId);
|
||||
Assert.Contains(listAfterAdd.Items, m => m.Id == IdHelper.EvanAlmighty);
|
||||
|
||||
// Remove the previously added movie from the list
|
||||
Assert.True(await TMDbClient.ListRemoveMovieAsync(TestListId, IdHelper.EvanAlmighty));
|
||||
|
||||
// Get list and check if the item was removed
|
||||
GenericList listAfterRemove = await TMDbClient.GetListAsync(TestListId);
|
||||
Assert.DoesNotContain(listAfterRemove.Items, m => m.Id == IdHelper.EvanAlmighty);
|
||||
foreach (AccountList list in lists.Results.Where(s => s.Name.StartsWith(EphemeralListPrefix)))
|
||||
{
|
||||
client.ListDeleteAsync(list.Id.ToString()).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestListClearAsync()
|
||||
[CollectionDefinition(nameof(ListFixturesCollection))]
|
||||
public class ListFixturesCollection : ICollectionFixture<ListCleanupFixture>
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Add a new movie to the list
|
||||
Assert.True(await TMDbClient.ListAddMovieAsync(TestListId, IdHelper.MadMaxFuryRoad));
|
||||
|
||||
// Get list and check if the item was added
|
||||
GenericList listAfterAdd = await TMDbClient.GetListAsync(TestListId);
|
||||
Assert.Contains(listAfterAdd.Items, m => m.Id == IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Clear the list
|
||||
Assert.True(await TMDbClient.ListClearAsync(TestListId));
|
||||
|
||||
// Get list and check that all items were removed
|
||||
GenericList listAfterRemove = await TMDbClient.GetListAsync(TestListId);
|
||||
Assert.False(listAfterRemove.Items.Any());
|
||||
// This class has no code, and is never created. Its purpose is simply
|
||||
// to be the place to apply [CollectionDefinition] and all the
|
||||
// ICollectionFixture<> interfaces.
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Authentication;
|
||||
@ -19,11 +18,11 @@ namespace TMDbLibTests
|
||||
{
|
||||
public class ClientMovieTests : TestBase
|
||||
{
|
||||
private static Dictionary<MovieMethods, Func<Movie, object>> _methods;
|
||||
private static readonly Dictionary<MovieMethods, Func<Movie, object>> Methods;
|
||||
|
||||
public ClientMovieTests()
|
||||
static ClientMovieTests()
|
||||
{
|
||||
_methods = new Dictionary<MovieMethods, Func<Movie, object>>
|
||||
Methods = new Dictionary<MovieMethods, Func<Movie, object>>
|
||||
{
|
||||
[MovieMethods.AlternativeTitles] = movie => movie.AlternativeTitles,
|
||||
[MovieMethods.Credits] = movie => movie.Credits,
|
||||
@ -49,13 +48,10 @@ namespace TMDbLibTests
|
||||
{
|
||||
Movie movie = await TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.NotNull(movie);
|
||||
|
||||
// TODO: Test all properties
|
||||
Assert.Equal("A Good Day to Die Hard", movie.Title);
|
||||
await Verify(movie);
|
||||
|
||||
// Test all extras, ensure none of them exist
|
||||
foreach (Func<Movie, object> selector in _methods.Values)
|
||||
foreach (Func<Movie, object> selector in Methods.Values)
|
||||
{
|
||||
Assert.Null(selector(movie));
|
||||
}
|
||||
@ -65,13 +61,14 @@ namespace TMDbLibTests
|
||||
public async void TestMoviesExtrasExclusive()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard, extras));
|
||||
|
||||
await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesImdbExtrasAllAsync()
|
||||
{
|
||||
Dictionary<MovieMethods, Func<Movie, object>> tmpMethods = new Dictionary<MovieMethods, Func<Movie, object>>(_methods);
|
||||
Dictionary<MovieMethods, Func<Movie, object>> tmpMethods = new Dictionary<MovieMethods, Func<Movie, object>>(Methods);
|
||||
tmpMethods.Remove(MovieMethods.Videos);
|
||||
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
@ -79,15 +76,7 @@ namespace TMDbLibTests
|
||||
// Account states will only show up if we've done something
|
||||
await TMDbClient.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(tmpMethods, combined => TMDbClient.GetMovieAsync(IdHelper.TheDarkKnightRisesImdb, combined));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesExtrasAll()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard, combined));
|
||||
await TestMethodsHelper.TestGetAll(tmpMethods, combined => TMDbClient.GetMovieAsync(IdHelper.TheDarkKnightRisesImdb, combined), movie => Verify(movie));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -101,62 +90,32 @@ namespace TMDbLibTests
|
||||
|
||||
Assert.Equal("A Good Day to Die Hard", movie.Title);
|
||||
Assert.NotEqual(movie.Title, movieItalian.Title);
|
||||
|
||||
// Test all extras, ensure none of them exist
|
||||
foreach (Func<Movie, object> selector in _methods.Values)
|
||||
{
|
||||
Assert.Null(selector(movie));
|
||||
Assert.Null(selector(movieItalian));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieAlternativeTitles()
|
||||
{
|
||||
AlternativeTitles respUs = await TMDbClient.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "US");
|
||||
Assert.NotNull(respUs);
|
||||
|
||||
AlternativeTitles respFrench = await TMDbClient.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "FR");
|
||||
Assert.NotNull(respFrench);
|
||||
|
||||
Assert.DoesNotContain(respUs.Titles, s => s.Title == "Duro de matar 5");
|
||||
Assert.Contains(respFrench.Titles, s => s.Title == "Die Hard 5 - Belle Journée Pour mourir");
|
||||
TMDbClient.DefaultCountry = "CA";
|
||||
|
||||
Assert.True(respUs.Titles.All(s => s.Iso_3166_1 == "US"));
|
||||
Assert.True(respFrench.Titles.All(s => s.Iso_3166_1 == "FR"));
|
||||
AlternativeTitles respCaDefault = await TMDbClient.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
await Verify(new
|
||||
{
|
||||
respUs,
|
||||
respFrench,
|
||||
respCaDefault
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieReleaseDates()
|
||||
{
|
||||
ResultContainer<ReleaseDatesContainer> resp = await TMDbClient.GetMovieReleaseDatesAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
ReleaseDatesContainer releasesUs = resp.Results.SingleOrDefault(s => s.Iso_3166_1 == "US");
|
||||
Assert.NotNull(releasesUs);
|
||||
Assert.Single(releasesUs.ReleaseDates);
|
||||
|
||||
ReleaseDateItem singleRelease = releasesUs.ReleaseDates.First();
|
||||
|
||||
Assert.Equal("R", singleRelease.Certification);
|
||||
Assert.Equal(string.Empty, singleRelease.Iso_639_1);
|
||||
Assert.Equal(string.Empty, singleRelease.Note);
|
||||
Assert.Equal(DateTime.Parse("2013-02-14T00:00:00.000Z").ToUniversalTime(), singleRelease.ReleaseDate);
|
||||
Assert.Equal(ReleaseDateType.Theatrical, singleRelease.Type);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieAlternativeTitlesCountry()
|
||||
{
|
||||
AlternativeTitles respUs = await TMDbClient.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "US");
|
||||
Assert.NotNull(respUs);
|
||||
|
||||
TMDbClient.DefaultCountry = "US";
|
||||
|
||||
AlternativeTitles respUs2 = await TMDbClient.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(respUs2);
|
||||
|
||||
Assert.Equal(respUs.Titles.Count, respUs2.Titles.Count);
|
||||
await Verify(resp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -165,29 +124,17 @@ namespace TMDbLibTests
|
||||
Credits resp = await TMDbClient.GetMovieCreditsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Cast cast = resp.Cast.SingleOrDefault(s => s.Name == "Bruce Willis");
|
||||
Assert.NotNull(cast);
|
||||
Cast cast = resp.Cast.Single(s => s.CreditId == "52fe4751c3a36847f812f049");
|
||||
Crew crew = resp.Crew.Single(s => s.CreditId == "5336b04a9251417db4000c80");
|
||||
|
||||
Assert.Equal(1, cast.CastId);
|
||||
Assert.Equal("John McClane", cast.Character);
|
||||
Assert.NotEmpty(cast.CreditId);
|
||||
Assert.Equal(62, cast.Id);
|
||||
Assert.Equal("Bruce Willis", cast.Name);
|
||||
Assert.Equal(0, cast.Order);
|
||||
Assert.True(cast.Popularity > 0);
|
||||
Assert.Equal("Bruce Willis", cast.OriginalName);
|
||||
Assert.Equal("Acting", cast.KnownForDepartment);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(cast.ProfilePath), "cast.ProfilePath was not a valid image path, was: " + cast.ProfilePath);
|
||||
await Verify(new
|
||||
{
|
||||
cast,
|
||||
crew
|
||||
});
|
||||
|
||||
Crew crew = resp.Crew.SingleOrDefault(s => s.Name == "Marco Beltrami");
|
||||
Assert.NotNull(crew);
|
||||
|
||||
Assert.NotEmpty(crew.CreditId);
|
||||
Assert.Equal("Sound", crew.Department);
|
||||
Assert.Equal(7229, crew.Id);
|
||||
Assert.Equal("Original Music Composer", crew.Job);
|
||||
Assert.Equal("Marco Beltrami", crew.Name);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(crew.ProfilePath), "crew.ProfilePath was not a valid image path, was: " + crew.ProfilePath);
|
||||
TestImagesHelpers.TestImagePaths(resp.Cast.Select(s => s.ProfilePath).Where(s => s != null));
|
||||
TestImagesHelpers.TestImagePaths(resp.Crew.Select(s => s.ProfilePath).Where(s => s != null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -195,111 +142,83 @@ namespace TMDbLibTests
|
||||
{
|
||||
ExternalIdsMovie externalIds = await TMDbClient.GetMovieExternalIdsAsync(IdHelper.BladeRunner2049);
|
||||
|
||||
Assert.NotNull(externalIds);
|
||||
Assert.Equal(335984, externalIds.Id);
|
||||
Assert.Equal("tt1856101", externalIds.ImdbId);
|
||||
Assert.Equal("BladeRunner2049", externalIds.FacebookId);
|
||||
Assert.Equal("bladerunner", externalIds.TwitterId);
|
||||
Assert.Equal("bladerunnermovie", externalIds.InstagramId);
|
||||
await Verify(externalIds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieImages()
|
||||
{
|
||||
ImagesWithId resp = await TMDbClient.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
ImageData backdrop = resp.Backdrops.SingleOrDefault(s => s.FilePath == "/17zArExB7ztm6fjUXZwQWgGMC9f.jpg");
|
||||
Assert.NotNull(backdrop);
|
||||
TestImagesHelpers.TestImagePaths(resp);
|
||||
|
||||
Assert.True(Math.Abs(1.77777777777778 - backdrop.AspectRatio) < double.Epsilon);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(backdrop.FilePath), "backdrop.FilePath was not a valid image path, was: " + backdrop.FilePath);
|
||||
Assert.Equal(1080, backdrop.Height);
|
||||
Assert.Equal("xx", backdrop.Iso_639_1);
|
||||
Assert.True(backdrop.VoteAverage > 0);
|
||||
Assert.True(backdrop.VoteCount > 0);
|
||||
Assert.Equal(1920, backdrop.Width);
|
||||
ImageData backdrop = resp.Backdrops.Single(s => s.FilePath == "/js3J4SBiRfLvmRzaHoTA2tpKROw.jpg");
|
||||
ImageData poster = resp.Posters.Single(s => s.FilePath == "/c4G6lW5hAWmwveThfLSqs52yHB1.jpg");
|
||||
|
||||
ImageData poster = resp.Posters.SingleOrDefault(s => s.FilePath == "/c2SQMd00CCGTiDxGXVqA2J9lmzF.jpg");
|
||||
Assert.NotNull(poster);
|
||||
|
||||
Assert.True(Math.Abs(0.666666666666667 - poster.AspectRatio) < double.Epsilon);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(poster.FilePath), "poster.FilePath was not a valid image path, was: " + poster.FilePath);
|
||||
Assert.Equal(1500, poster.Height);
|
||||
Assert.Equal("en", poster.Iso_639_1);
|
||||
Assert.True(poster.VoteAverage > 0);
|
||||
Assert.True(poster.VoteCount > 0);
|
||||
Assert.Equal(1000, poster.Width);
|
||||
await Verify(new
|
||||
{
|
||||
backdrop,
|
||||
poster
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieImagesWithImageLanguage()
|
||||
{
|
||||
ImagesWithId resp = await TMDbClient.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard, language: "en-US", includeImageLanguage: "en");
|
||||
ImagesWithId images = await TMDbClient.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard, "en-US", "en");
|
||||
|
||||
Assert.True(resp.Backdrops.Count > 0);
|
||||
Assert.True(resp.Posters.Count > 0);
|
||||
TestImagesHelpers.TestImagePaths(images);
|
||||
|
||||
ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/js3J4SBiRfLvmRzaHoTA2tpKROw.jpg");
|
||||
ImageData poster = images.Posters.Single(s => s.FilePath == "/9Zq88w35f1PpM22TIbf2amtjHD6.jpg");
|
||||
|
||||
await Verify(new
|
||||
{
|
||||
backdrop,
|
||||
poster
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieWithImageLanguage()
|
||||
{
|
||||
Movie resp = await TMDbClient.GetMovieAsync(IdHelper.Avatar, language: "en-US", includeImageLanguage: "en", extraMethods: MovieMethods.Images);
|
||||
Movie resp = await TMDbClient.GetMovieAsync(IdHelper.Avatar, "de-DE", "de", MovieMethods.Images);
|
||||
Images images = resp.Images;
|
||||
|
||||
Assert.True(resp.Images.Backdrops.Count > 0);
|
||||
Assert.True(resp.Images.Backdrops.All(b => b.Iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase)));
|
||||
Assert.True(resp.Images.Posters.Count > 0);
|
||||
Assert.True(resp.Images.Posters.All(p => p.Iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase)));
|
||||
TestImagesHelpers.TestImagePaths(images);
|
||||
|
||||
ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/4U9fN2jsQ94GQfDGeLEe8UaReRO.jpg");
|
||||
ImageData poster = images.Posters.Single(s => s.FilePath == "/8VV4YUwOGxgolFZTo2SgNwsfznR.jpg");
|
||||
|
||||
await Verify(new
|
||||
{
|
||||
backdrop,
|
||||
poster
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieKeywords()
|
||||
{
|
||||
KeywordsContainer resp = await TMDbClient.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard);
|
||||
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);
|
||||
await Verify(resp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieReleases()
|
||||
{
|
||||
Releases resp = await TMDbClient.GetMovieReleasesAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Country country = resp.Countries.SingleOrDefault(s => s.Iso_3166_1 == "US");
|
||||
Assert.NotNull(country);
|
||||
|
||||
Assert.Equal("R", country.Certification);
|
||||
Assert.Equal("US", country.Iso_3166_1);
|
||||
Assert.False(country.Primary);
|
||||
Assert.Equal(new DateTime(2013, 2, 14), country.ReleaseDate);
|
||||
await Verify(resp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieVideos()
|
||||
{
|
||||
ResultContainer<Video> resp = await TMDbClient.GetMovieVideosAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Assert.NotNull(resp);
|
||||
Assert.NotNull(resp.Results);
|
||||
|
||||
Video video = resp.Results[0];
|
||||
Assert.NotNull(video);
|
||||
|
||||
Assert.Equal("533ec6a7c3a368544800556f", video.Id);
|
||||
Assert.Equal("en", video.Iso_639_1);
|
||||
Assert.Equal("US", video.Iso_3166_1);
|
||||
Assert.Equal("7EgVRvG2mM0", video.Key);
|
||||
Assert.Equal("A Good Day To Die Hard Official Trailer", video.Name);
|
||||
Assert.Equal("YouTube", video.Site);
|
||||
Assert.Equal(720, video.Size);
|
||||
Assert.Equal("Trailer", video.Type);
|
||||
await Verify(resp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -319,424 +238,178 @@ namespace TMDbLibTests
|
||||
public async void TestMoviesGetMovieTranslations()
|
||||
{
|
||||
TranslationsContainer resp = await TMDbClient.GetMovieTranslationsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Translation translation = resp.Translations.SingleOrDefault(s => s.EnglishName == "German");
|
||||
Assert.NotNull(translation);
|
||||
|
||||
Assert.Equal("German", translation.EnglishName);
|
||||
Assert.Equal("DE", translation.Iso_3166_1);
|
||||
Assert.Equal("de", translation.Iso_639_1);
|
||||
Assert.Equal("Deutsch", translation.Name);
|
||||
await Verify(resp);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieSimilarMovies()
|
||||
{
|
||||
SearchContainer<SearchMovie> resp = await TMDbClient.GetMovieSimilarAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
SearchContainer<SearchMovie> respGerman = await TMDbClient.GetMovieSimilarAsync(IdHelper.AGoodDayToDieHard, "de");
|
||||
|
||||
SearchContainer<SearchMovie> respGerman = await TMDbClient.GetMovieSimilarAsync(IdHelper.AGoodDayToDieHard, language: "de");
|
||||
Assert.NotNull(respGerman);
|
||||
SearchMovie single = resp.Results.Single(s => s.Id == 708);
|
||||
SearchMovie singleGerman = respGerman.Results.Single(s => s.Id == 708);
|
||||
|
||||
Assert.Equal(resp.Results.Count, respGerman.Results.Count);
|
||||
|
||||
int differentTitles = 0;
|
||||
for (int i = 0; i < resp.Results.Count; i++)
|
||||
await Verify(new
|
||||
{
|
||||
Assert.Equal(resp.Results[i].Id, respGerman.Results[i].Id);
|
||||
|
||||
// At least one title should be different, as German is a big language and they dub all their titles.
|
||||
differentTitles++;
|
||||
}
|
||||
|
||||
Assert.True(differentTitles > 0);
|
||||
single,
|
||||
singleGerman
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieRecommendationsMovies()
|
||||
{
|
||||
SearchContainer<SearchMovie> resp = await TMDbClient.GetMovieRecommendationsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
SearchContainer<SearchMovie> respGerman = await TMDbClient.GetMovieRecommendationsAsync(IdHelper.AGoodDayToDieHard, "de");
|
||||
|
||||
SearchContainer<SearchMovie> respGerman = await TMDbClient.GetMovieRecommendationsAsync(IdHelper.AGoodDayToDieHard, language: "de");
|
||||
Assert.NotNull(respGerman);
|
||||
SearchMovie single = resp.Results.Single(s => s.Id == 1571);
|
||||
SearchMovie singleGerman = respGerman.Results.Single(s => s.Id == 1571);
|
||||
|
||||
Assert.Equal(resp.Results.Count, respGerman.Results.Count);
|
||||
|
||||
int differentTitles = 0;
|
||||
for (int i = 0; i < resp.Results.Count; i++)
|
||||
await Verify(new
|
||||
{
|
||||
Assert.Equal(resp.Results[i].Id, respGerman.Results[i].Id);
|
||||
|
||||
// At least one title should be different, as German is a big language and they dub all their titles.
|
||||
differentTitles++;
|
||||
}
|
||||
|
||||
Assert.True(differentTitles > 0);
|
||||
single,
|
||||
singleGerman
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieReviews()
|
||||
{
|
||||
SearchContainerWithId<ReviewBase> resp = await TMDbClient.GetMovieReviewsAsync(IdHelper.TheDarkKnightRises);
|
||||
Assert.NotNull(resp);
|
||||
SearchContainerWithId<ReviewBase> resp = await TMDbClient.GetMovieReviewsAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.NotEqual(0, resp.Results.Count);
|
||||
Assert.NotNull(resp.Results[0].Content);
|
||||
ReviewBase single = resp.Results.Single(s => s.Id == "5ae9d7ae0e0a26394e008aeb");
|
||||
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieLists()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync<SearchContainerWithId<ListResult>, ListResult>(page => TMDbClient.GetMovieListsAsync(IdHelper.AGoodDayToDieHard, page));
|
||||
|
||||
SearchContainerWithId<ListResult> resp = await TMDbClient.GetMovieListsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Assert.Equal(IdHelper.AGoodDayToDieHard, resp.Id);
|
||||
|
||||
SearchContainerWithId<ListResult> respPage2 = await TMDbClient.GetMovieListsAsync(IdHelper.AGoodDayToDieHard, 2);
|
||||
Assert.NotNull(respPage2);
|
||||
|
||||
Assert.Equal(1, resp.Page);
|
||||
Assert.Equal(2, respPage2.Page);
|
||||
Assert.Equal(resp.TotalResults, resp.TotalResults);
|
||||
Assert.NotEmpty(resp.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesGetMovieChangesAsync()
|
||||
{
|
||||
//GetMovieChangesAsync(int id, DateTime? startDate = null, DateTime? endDate = null)
|
||||
// FindAsync latest changed title
|
||||
Movie lastestMovie = await TMDbClient.GetMovieLatestAsync();
|
||||
int latestChanged = lastestMovie.Id;
|
||||
IList<Change> changes = await TMDbClient.GetMovieChangesAsync(IdHelper.Avatar, startDate: DateTime.UtcNow.AddYears(-1));
|
||||
|
||||
// Fetch changelog
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-13);
|
||||
DateTime higher = DateTime.UtcNow.AddDays(1);
|
||||
List<Change> respRange = await TMDbClient.GetMovieChangesAsync(latestChanged, lower, higher);
|
||||
|
||||
Assert.NotNull(respRange);
|
||||
Assert.True(respRange.Count > 0);
|
||||
|
||||
// As TMDb works in days, we need to adjust our values also
|
||||
lower = lower.AddDays(-1);
|
||||
higher = higher.AddDays(1);
|
||||
|
||||
foreach (Change change in respRange)
|
||||
foreach (ChangeItemBase changeItem in change.Items)
|
||||
{
|
||||
DateTime date = changeItem.Time;
|
||||
Assert.True(lower <= date);
|
||||
Assert.True(date <= higher);
|
||||
}
|
||||
Assert.NotEmpty(changes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesMissing()
|
||||
{
|
||||
Movie movie1 = await TMDbClient.GetMovieAsync(IdHelper.MissingID);
|
||||
Assert.Null(movie1);
|
||||
|
||||
Movie movie2 = await TMDbClient.GetMovieAsync(IdHelper.MissingMovie);
|
||||
Assert.Null(movie2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesImagesAsync()
|
||||
{
|
||||
// Get config
|
||||
await TMDbClient.GetConfigAsync();
|
||||
|
||||
// Test image url generator
|
||||
ImagesWithId images = await TMDbClient.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.Equal(IdHelper.AGoodDayToDieHard, images.Id);
|
||||
await TestImagesHelpers.TestImagesAsync(TestConfig, images);
|
||||
Movie movie = await TMDbClient.GetMovieAsync(IdHelper.MissingID);
|
||||
Assert.Null(movie);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesPopularList()
|
||||
{
|
||||
SearchContainer<SearchMovie> list = await TMDbClient.GetMoviePopularListAsync();
|
||||
await TestHelpers.SearchPagesAsync(page => TMDbClient.GetMoviePopularListAsync(page: page));
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainer<SearchMovie> listPage2 = await TMDbClient.GetMoviePopularListAsync(page: 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainer<SearchMovie> listDe = await TMDbClient.GetMoviePopularListAsync("de");
|
||||
|
||||
Assert.NotNull(listDe);
|
||||
Assert.True(listDe.Results.Count > 0);
|
||||
Assert.Equal(1, listDe.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.Contains(list.Results, s => listDe.Results.Any(x => x.Title != s.Title));
|
||||
|
||||
SearchContainer<SearchMovie> listRegion = await TMDbClient.GetMoviePopularListAsync(region: "de");
|
||||
|
||||
Assert.NotNull(listRegion);
|
||||
Assert.True(listRegion.Results.Count > 0);
|
||||
Assert.Equal(1, listRegion.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.Contains(listDe.Results, s => listRegion.Results.Any(x => x.Title != s.Title));
|
||||
SearchContainer<SearchMovie> list = await TMDbClient.GetMoviePopularListAsync("de");
|
||||
Assert.NotEmpty(list.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesTopRatedList()
|
||||
{
|
||||
SearchContainer<SearchMovie> list = await TMDbClient.GetMovieTopRatedListAsync();
|
||||
await TestHelpers.SearchPagesAsync(page => TMDbClient.GetMovieTopRatedListAsync(page: page));
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainer<SearchMovie> listPage2 = await TMDbClient.GetMovieTopRatedListAsync(page: 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainer<SearchMovie> listDe = await TMDbClient.GetMovieTopRatedListAsync("de");
|
||||
|
||||
Assert.NotNull(listDe);
|
||||
Assert.True(listDe.Results.Count > 0);
|
||||
Assert.Equal(1, listDe.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.Contains(list.Results, s => listDe.Results.Any(x => x.Title != s.Title));
|
||||
|
||||
SearchContainer<SearchMovie> listRegion = await TMDbClient.GetMovieTopRatedListAsync(region: "de");
|
||||
|
||||
Assert.NotNull(listRegion);
|
||||
Assert.True(listRegion.Results.Count > 0);
|
||||
Assert.Equal(1, listRegion.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.Contains(listDe.Results, s => listRegion.Results.Any(x => x.Title != s.Title));
|
||||
SearchContainer<SearchMovie> list = await TMDbClient.GetMovieTopRatedListAsync("de");
|
||||
Assert.NotEmpty(list.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesNowPlayingList()
|
||||
{
|
||||
SearchContainerWithDates<SearchMovie> list = await TMDbClient.GetMovieNowPlayingListAsync();
|
||||
await TestHelpers.SearchPagesAsync<SearchContainerWithDates<SearchMovie>, SearchMovie>(page => TMDbClient.GetMovieNowPlayingListAsync(page: page));
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listPage2 = await TMDbClient.GetMovieNowPlayingListAsync(page: 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listDe = await TMDbClient.GetMovieNowPlayingListAsync("de");
|
||||
|
||||
Assert.NotNull(listDe);
|
||||
Assert.True(listDe.Results.Count > 0);
|
||||
Assert.Equal(1, listDe.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.Contains(list.Results, s => listDe.Results.Any(x => x.Title != s.Title));
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listRegion = await TMDbClient.GetMovieNowPlayingListAsync(region: "de");
|
||||
|
||||
Assert.NotNull(listRegion);
|
||||
Assert.True(listRegion.Results.Count > 0);
|
||||
Assert.Equal(1, listRegion.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.Contains(listDe.Results, s => listRegion.Results.Any(x => x.Title != s.Title));
|
||||
SearchContainer<SearchMovie> list = await TMDbClient.GetMovieNowPlayingListAsync("de");
|
||||
Assert.NotEmpty(list.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesUpcomingList()
|
||||
{
|
||||
SearchContainerWithDates<SearchMovie> list = await TMDbClient.GetMovieUpcomingListAsync();
|
||||
await TestHelpers.SearchPagesAsync<SearchContainerWithDates<SearchMovie>, SearchMovie>(page => TMDbClient.GetMovieUpcomingListAsync(page: page));
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listPage2 = await TMDbClient.GetMovieUpcomingListAsync(page: 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listDe = await TMDbClient.GetMovieUpcomingListAsync(language: "de");
|
||||
|
||||
Assert.NotNull(listDe);
|
||||
Assert.True(listDe.Results.Count > 0);
|
||||
Assert.Equal(1, listDe.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.Contains(list.Results, s => listDe.Results.Any(x => x.Title != s.Title));
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listDeRegion = await TMDbClient.GetMovieUpcomingListAsync(region: "de");
|
||||
|
||||
Assert.NotNull(listDeRegion);
|
||||
Assert.True(listDeRegion.Results.Count > 0);
|
||||
Assert.Equal(1, listDeRegion.Page);
|
||||
|
||||
// At least one title should differ
|
||||
Assert.Contains(listDe.Results, s => listDeRegion.Results.Any(x => x.Title != s.Title));
|
||||
SearchContainer<SearchMovie> list = await TMDbClient.GetMovieUpcomingListAsync("de");
|
||||
Assert.NotEmpty(list.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesAccountStateFavoriteSetAsync()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Remove the favourite
|
||||
if (accountState.Favorite)
|
||||
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false);
|
||||
await TestMethodsHelper.SetValidateRemoveTest(
|
||||
() => TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true),
|
||||
() => TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false),
|
||||
async shouldBeSet =>
|
||||
{
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie is NOT favourited
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.False(accountState.Favorite);
|
||||
|
||||
// Favourite the movie
|
||||
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie IS favourited
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.True(accountState.Favorite);
|
||||
Assert.Equal(shouldBeSet, accountState.Favorite);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesAccountStateWatchlistSetAsync()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Remove the watchlist
|
||||
if (accountState.Watchlist)
|
||||
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false);
|
||||
await TestMethodsHelper.SetValidateRemoveTest(
|
||||
() => TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true),
|
||||
() => TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false),
|
||||
async shouldBeSet =>
|
||||
{
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie is NOT watchlisted
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.False(accountState.Watchlist);
|
||||
|
||||
// Watchlist the movie
|
||||
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie IS watchlisted
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.True(accountState.Watchlist);
|
||||
Assert.Equal(shouldBeSet, accountState.Watchlist);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesAccountStateRatingSetAsync()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Remove the rating
|
||||
if (accountState.Rating.HasValue)
|
||||
{
|
||||
Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad));
|
||||
await TestMethodsHelper.SetValidateRemoveTest(
|
||||
() => TMDbClient.MovieSetRatingAsync(IdHelper.MadMaxFuryRoad, 7.5),
|
||||
() => TMDbClient.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad),
|
||||
async shouldBeSet =>
|
||||
{
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
|
||||
// Test that the movie is NOT rated
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.False(accountState.Rating.HasValue);
|
||||
|
||||
// Rate the movie
|
||||
await TMDbClient.MovieSetRatingAsync(IdHelper.MadMaxFuryRoad, 5);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie IS rated
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.True(accountState.Rating.HasValue);
|
||||
|
||||
// Remove the rating
|
||||
Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad));
|
||||
Assert.Equal(shouldBeSet, accountState.Rating.HasValue);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingBadRating()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
Assert.False(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, 7.1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingRatingOutOfBounds()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, 8.0));
|
||||
|
||||
Assert.False(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, 10.5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingRatingLowerBoundsTest()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, 1.5));
|
||||
|
||||
Assert.False(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingUserSession()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Ensure that the test movie has a different rating than our test rating
|
||||
double? rating = (await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating;
|
||||
Assert.NotNull(rating);
|
||||
|
||||
double originalRating = rating.Value;
|
||||
double newRating = Math.Abs(originalRating - 7.5) < double.Epsilon ? 2.5 : 7.5;
|
||||
|
||||
// Try changing the rating
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, newRating));
|
||||
|
||||
// Allow TMDb to not cache our data
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Check if it worked
|
||||
Assert.Equal(newRating, (await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating);
|
||||
|
||||
// Try changing it back to the previous rating
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, originalRating));
|
||||
|
||||
// Allow TMDb to not cache our data
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Check if it worked
|
||||
Assert.Equal(originalRating, (await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating);
|
||||
Assert.False(await TMDbClient.MovieRemoveRatingAsync(IdHelper.Avatar));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -749,55 +422,6 @@ namespace TMDbLibTests
|
||||
Assert.DoesNotContain("&", item.Overview);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGet()
|
||||
{
|
||||
Movie item = await TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(IdHelper.AGoodDayToDieHard, item.Id);
|
||||
Assert.Equal(IdHelper.AGoodDayToDieHardImdb, item.ImdbId);
|
||||
|
||||
// Check all properties
|
||||
Assert.Equal("A Good Day to Die Hard", item.Title);
|
||||
Assert.Equal("A Good Day to Die Hard", item.OriginalTitle);
|
||||
Assert.Equal("en", item.OriginalLanguage);
|
||||
|
||||
Assert.Equal("Released", item.Status);
|
||||
Assert.Equal("Yippee Ki-Yay Mother Russia", item.Tagline);
|
||||
Assert.Equal("Iconoclastic, take-no-prisoners cop John McClane, finds himself for the first time on foreign soil after traveling to Moscow to help his wayward son Jack - unaware that Jack is really a highly-trained CIA operative out to stop a nuclear weapons heist. With the Russian underworld in pursuit, and battling a countdown to war, the two McClanes discover that their opposing methods make them unstoppable heroes.", item.Overview);
|
||||
Assert.Equal("http://www.diehardmovie.com/", item.Homepage);
|
||||
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.BackdropPath), "item.BackdropPath was not a valid image path, was: " + item.BackdropPath);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.PosterPath), "item.PosterPath was not a valid image path, was: " + item.PosterPath);
|
||||
|
||||
Assert.False(item.Adult);
|
||||
Assert.False(item.Video);
|
||||
|
||||
Assert.NotNull(item.BelongsToCollection);
|
||||
Assert.Equal(1570, item.BelongsToCollection.Id);
|
||||
Assert.Equal("Die Hard Collection", item.BelongsToCollection.Name);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.BelongsToCollection.BackdropPath), "item.BelongsToCollection.BackdropPath was not a valid image path, was: " + item.BelongsToCollection.BackdropPath);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.BelongsToCollection.PosterPath), "item.BelongsToCollection.PosterPath was not a valid image path, was: " + item.BelongsToCollection.PosterPath);
|
||||
|
||||
//Assert.Equal(1, item.BelongsToCollection.Count);
|
||||
//Assert.Equal(1570, item.BelongsToCollection[0].Id);
|
||||
//Assert.Equal("Die Hard Collection", item.BelongsToCollection[0].Name);
|
||||
//Assert.True(TestImagesHelpers.TestImagePath(item.BelongsToCollection[0].BackdropPath), "item.BelongsToCollection[0].BackdropPath was not a valid image path, was: " + item.BelongsToCollection[0].BackdropPath);
|
||||
//Assert.True(TestImagesHelpers.TestImagePath(item.BelongsToCollection[0].PosterPath), "item.BelongsToCollection[0].PosterPath was not a valid image path, was: " + item.BelongsToCollection[0].PosterPath);
|
||||
|
||||
Assert.Equal(2, item.Genres.Count);
|
||||
Assert.Equal(28, item.Genres[0].Id);
|
||||
Assert.Equal("Action", item.Genres[0].Name);
|
||||
Assert.Equal(53, item.Genres[1].Id);
|
||||
Assert.Equal("Thriller", item.Genres[1].Name);
|
||||
|
||||
Assert.True(item.ReleaseDate > new DateTime(2013, 01, 01));
|
||||
Assert.Equal(304654182, item.Revenue);
|
||||
Assert.Equal(92000000, item.Budget);
|
||||
Assert.Equal(98, item.Runtime);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesExtrasAccountStateAsync()
|
||||
{
|
||||
@ -805,7 +429,8 @@ namespace TMDbLibTests
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
Movie movie = await TMDbClient.GetMovieAsync(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates);
|
||||
if (movie.AccountStates == null || !movie.AccountStates.Rating.HasValue)
|
||||
|
||||
if (movie.AccountStates?.Rating == null)
|
||||
{
|
||||
await TMDbClient.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5);
|
||||
|
||||
|
@ -14,32 +14,23 @@ namespace TMDbLibTests
|
||||
{
|
||||
Network network = await TMDbClient.GetNetworkAsync(IdHelper.Netflix);
|
||||
|
||||
Assert.NotNull(network);
|
||||
Assert.Equal("Netflix", network.Name);
|
||||
Assert.Equal(IdHelper.Netflix, network.Id);
|
||||
Assert.Equal("http://www.netflix.com", network.Homepage);
|
||||
Assert.Equal("Los Gatos, California, United States", network.Headquarters);
|
||||
await Verify(network);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestNetworkImagesAsync()
|
||||
{
|
||||
NetworkLogos logos = await TMDbClient.GetNetworkImagesAsync(IdHelper.Netflix);
|
||||
|
||||
Assert.NotNull(logos);
|
||||
Assert.Equal(IdHelper.Netflix, logos.Id);
|
||||
Assert.Equal("/wwemzKWzjKYJFfCeiB57q3r4Bcm.png", logos.Logos[0].FilePath);
|
||||
|
||||
await Verify(logos);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestNetworkAlternativeNamesAsync()
|
||||
{
|
||||
AlternativeNames names = await TMDbClient.GetNetworkAlternativeNamesAsync(IdHelper.AMC);
|
||||
|
||||
Assert.NotNull(names);
|
||||
Assert.Equal(IdHelper.AMC, names.Id);
|
||||
Assert.Equal("American Movie Classics", names.Results[0].Name);
|
||||
Assert.Equal("1984–2002", names.Results[0].Type);
|
||||
|
||||
await Verify(names);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -14,11 +14,11 @@ namespace TMDbLibTests
|
||||
{
|
||||
public class ClientPersonTests : TestBase
|
||||
{
|
||||
private static Dictionary<PersonMethods, Func<Person, object>> _methods;
|
||||
private static readonly Dictionary<PersonMethods, Func<Person, object>> Methods;
|
||||
|
||||
public ClientPersonTests()
|
||||
static ClientPersonTests()
|
||||
{
|
||||
_methods = new Dictionary<PersonMethods, Func<Person, object>>
|
||||
Methods = new Dictionary<PersonMethods, Func<Person, object>>
|
||||
{
|
||||
[PersonMethods.MovieCredits] = person => person.MovieCredits,
|
||||
[PersonMethods.TvCredits] = person => person.TvCredits,
|
||||
@ -34,37 +34,23 @@ namespace TMDbLibTests
|
||||
{
|
||||
Person person = await TMDbClient.GetPersonAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(person);
|
||||
|
||||
Assert.Equal("Bruce Willis", person.Name);
|
||||
|
||||
// Test all extras, ensure none of them exist
|
||||
foreach (Func<Person, object> selector in _methods.Values)
|
||||
{
|
||||
foreach (Func<Person, object> selector in Methods.Values)
|
||||
Assert.Null(selector(person));
|
||||
}
|
||||
|
||||
await Verify(person);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsExtrasExclusive()
|
||||
{
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetPersonAsync(IdHelper.BruceWillis, extras));
|
||||
await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetPersonAsync(IdHelper.BruceWillis, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsExtrasAllAsync()
|
||||
{
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetPersonAsync(IdHelper.BruceWillis, combined));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsGetWithPartialDateAsync()
|
||||
{
|
||||
Person item = await TMDbClient.GetPersonAsync(IdHelper.PersonPartialDate);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Null(item.Birthday);
|
||||
Assert.Null(item.Deathday);
|
||||
await TestMethodsHelper.TestGetAll(Methods, combined => TMDbClient.GetPersonAsync(IdHelper.FrankSinatra, combined), async person => await Verify(person));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -75,267 +61,84 @@ namespace TMDbLibTests
|
||||
Assert.Null(person);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsGetAsync()
|
||||
{
|
||||
Person item = await TMDbClient.GetPersonAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.False(item.Adult);
|
||||
Assert.NotNull(item.Biography);
|
||||
Assert.Equal(PersonGender.Male, item.Gender);
|
||||
Assert.Equal(new DateTime(1955, 3, 19), item.Birthday);
|
||||
Assert.False(item.Deathday.HasValue);
|
||||
Assert.Equal("http://www.b-willis.com/", item.Homepage);
|
||||
Assert.Equal(62, item.Id);
|
||||
Assert.Equal("nm0000246", item.ImdbId);
|
||||
Assert.Equal("Bruce Willis", item.Name);
|
||||
Assert.Equal("Idar-Oberstein, Germany", item.PlaceOfBirth);
|
||||
Assert.True(item.Popularity > 0);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.ProfilePath), "item.ProfilePath was not a valid image path, was: " + item.ProfilePath);
|
||||
|
||||
Assert.NotNull(item.AlsoKnownAs);
|
||||
Assert.Equal(2, item.AlsoKnownAs.Count);
|
||||
Assert.Contains("Брюс Уиллис", item.AlsoKnownAs);
|
||||
Assert.Contains("브루스 윌리스", item.AlsoKnownAs);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsGetPersonTvCreditsAsync()
|
||||
{
|
||||
TvCredits item = await TMDbClient.GetPersonTvCreditsAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.NotNull(item.Cast);
|
||||
Assert.NotNull(item.Crew);
|
||||
Assert.NotEmpty(item.Cast);
|
||||
Assert.NotEmpty(item.Crew);
|
||||
|
||||
Assert.Equal(IdHelper.BruceWillis, item.Id);
|
||||
TvRole cast = item.Cast.Single(s => s.CreditId == "52571e7f19c2957114107d48");
|
||||
TvJob crew = item.Crew.Single(s => s.CreditId == "525826eb760ee36aaa81b23b");
|
||||
|
||||
TvRole cast = item.Cast.SingleOrDefault(s => s.Character == "David Addison Jr.");
|
||||
Assert.NotNull(cast);
|
||||
Assert.Equal("David Addison Jr.", cast.Character);
|
||||
Assert.Equal("52571e7f19c2957114107d48", cast.CreditId);
|
||||
Assert.Equal(71, cast.EpisodeCount);
|
||||
Assert.Equal(new DateTime(1985, 3, 3), cast.FirstAirDate);
|
||||
Assert.Equal(1998, cast.Id);
|
||||
Assert.Equal("Moonlighting", cast.Name);
|
||||
Assert.Equal("Moonlighting", cast.OriginalName);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(cast.PosterPath), "cast.PosterPath was not a valid image path, was: " + cast.PosterPath);
|
||||
|
||||
TvJob job = item.Crew.SingleOrDefault(s => s.CreditId == "525826eb760ee36aaa81b23b");
|
||||
Assert.NotNull(job);
|
||||
Assert.Equal("525826eb760ee36aaa81b23b", job.CreditId);
|
||||
Assert.Equal("Production", job.Department);
|
||||
Assert.Equal(37, job.EpisodeCount);
|
||||
Assert.Equal(new DateTime(1996, 9, 23), job.FirstAirDate);
|
||||
Assert.Equal(13297, job.Id);
|
||||
Assert.Equal("Producer", job.Job);
|
||||
Assert.Equal("Bruno the Kid", job.Name);
|
||||
Assert.Equal("Bruno the Kid", job.OriginalName);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(job.PosterPath), "job.PosterPath was not a valid image path, was: " + job.PosterPath);
|
||||
await Verify(new
|
||||
{
|
||||
cast,
|
||||
crew
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsGetPersonMovieCreditsAsync()
|
||||
public async Task TestGetPersonMovieCreditsAsync()
|
||||
{
|
||||
MovieCredits item = await TMDbClient.GetPersonMovieCreditsAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.NotNull(item.Cast);
|
||||
Assert.NotNull(item.Crew);
|
||||
Assert.NotEmpty(item.Cast);
|
||||
Assert.NotEmpty(item.Crew);
|
||||
|
||||
Assert.Equal(IdHelper.BruceWillis, item.Id);
|
||||
MovieRole cast = item.Cast.Single(s => s.CreditId == "52fe4329c3a36847f803f193");
|
||||
MovieJob crew = item.Crew.Single(s => s.CreditId == "52fe432ec3a36847f8040603");
|
||||
|
||||
MovieRole cast = item.Cast.SingleOrDefault(s => s.CreditId == "52fe4329c3a36847f803f193");
|
||||
Assert.NotNull(cast);
|
||||
Assert.False(cast.Adult);
|
||||
Assert.Equal("Lieutenant Muldoon", cast.Character);
|
||||
Assert.Equal("52fe4329c3a36847f803f193", cast.CreditId);
|
||||
Assert.Equal(1992, cast.Id);
|
||||
Assert.Equal("Planet Terror", cast.OriginalTitle);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(cast.PosterPath), "cast.PosterPath was not a valid image path, was: " + cast.PosterPath);
|
||||
Assert.Equal(new DateTime(2007, 4, 6), cast.ReleaseDate);
|
||||
Assert.Equal("Planet Terror", cast.Title);
|
||||
|
||||
MovieJob job = item.Crew.SingleOrDefault(s => s.CreditId == "52fe432ec3a36847f8040603");
|
||||
Assert.NotNull(job);
|
||||
Assert.False(job.Adult);
|
||||
Assert.Equal("52fe432ec3a36847f8040603", job.CreditId);
|
||||
Assert.Equal("Production", job.Department);
|
||||
Assert.Equal(2026, job.Id);
|
||||
Assert.Equal("Producer", job.Job);
|
||||
Assert.Equal(new DateTime(2005, 3, 9), job.ReleaseDate);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(job.PosterPath), "job.PosterPath was not a valid image path, was: " + job.PosterPath);
|
||||
Assert.Equal("Hostage", job.Title);
|
||||
Assert.Equal("Hostage", job.OriginalTitle);
|
||||
await Verify(new
|
||||
{
|
||||
cast,
|
||||
crew
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsGetPersonExternalIdsAsync()
|
||||
public async Task TestGetPersonExternalIdsAsync()
|
||||
{
|
||||
ExternalIdsPerson item = await TMDbClient.GetPersonExternalIdsAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(IdHelper.BruceWillis, item.Id);
|
||||
Assert.Equal("nm0000246", item.ImdbId);
|
||||
Assert.Equal("/m/0h7pj", item.FreebaseMid);
|
||||
Assert.Equal("/en/bruce_willis", item.FreebaseId);
|
||||
Assert.Equal("10183", item.TvrageId);
|
||||
Assert.Null(item.FacebookId);
|
||||
|
||||
item = await TMDbClient.GetPersonExternalIdsAsync(IdHelper.JoshACagan);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(IdHelper.JoshACagan, item.Id);
|
||||
Assert.Null(item.FacebookId);
|
||||
Assert.Equal("joshacagan", item.TwitterId);
|
||||
Assert.Equal("joshacagan", item.InstagramId);
|
||||
await Verify(item);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsGetPersonCreditsAsync()
|
||||
public async Task TestGetChangesPeopleAsync()
|
||||
{
|
||||
//GetPersonCredits(int id, string language)
|
||||
MovieCredits resp = await TMDbClient.GetPersonMovieCreditsAsync(IdHelper.BruceWillis);
|
||||
Assert.NotNull(resp);
|
||||
SearchContainer<ChangesListItem> latestChanges = await TMDbClient.GetPeopleChangesAsync();
|
||||
|
||||
MovieCredits respItalian = await TMDbClient.GetPersonMovieCreditsAsync(IdHelper.BruceWillis, "it");
|
||||
Assert.NotNull(respItalian);
|
||||
|
||||
Assert.Equal(resp.Cast.Count, respItalian.Cast.Count);
|
||||
Assert.Equal(resp.Crew.Count, respItalian.Crew.Count);
|
||||
Assert.Equal(resp.Id, respItalian.Id);
|
||||
|
||||
// There must be at least one movie with a different title
|
||||
bool allTitlesIdentical = true;
|
||||
for (int index = 0; index < resp.Cast.Count; index++)
|
||||
{
|
||||
Assert.Equal(resp.Cast[index].Id, respItalian.Cast[index].Id);
|
||||
Assert.Equal(resp.Cast[index].OriginalTitle, respItalian.Cast[index].OriginalTitle);
|
||||
|
||||
if (resp.Cast[index].Title != respItalian.Cast[index].Title)
|
||||
allTitlesIdentical = false;
|
||||
}
|
||||
|
||||
for (int index = 0; index < resp.Crew.Count; index++)
|
||||
{
|
||||
Assert.Equal(resp.Crew[index].Id, respItalian.Crew[index].Id);
|
||||
Assert.Equal(resp.Crew[index].OriginalTitle, respItalian.Crew[index].OriginalTitle);
|
||||
|
||||
if (resp.Crew[index].Title != respItalian.Crew[index].Title)
|
||||
allTitlesIdentical = false;
|
||||
}
|
||||
|
||||
Assert.False(allTitlesIdentical);
|
||||
Assert.NotEmpty(latestChanges.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsGetPersonChangesAsync()
|
||||
public async Task TestGetPersonImagesAsync()
|
||||
{
|
||||
// FindAsync latest changed person
|
||||
SearchContainer<ChangesListItem> latestChanges = await TMDbClient.GetChangesPeopleAsync();
|
||||
int latestChanged = latestChanges.Results.Last().Id;
|
||||
|
||||
// Fetch changelog
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-14);
|
||||
DateTime higher = DateTime.UtcNow;
|
||||
List<Change> respRange = await TMDbClient.GetPersonChangesAsync(latestChanged, lower, higher);
|
||||
|
||||
Assert.NotNull(respRange);
|
||||
Assert.True(respRange.Count > 0);
|
||||
|
||||
// As TMDb works in days, we need to adjust our values also
|
||||
lower = lower.AddDays(-1);
|
||||
higher = higher.AddDays(1);
|
||||
|
||||
foreach (Change change in respRange)
|
||||
foreach (ChangeItemBase changeItem in change.Items)
|
||||
{
|
||||
DateTime date = changeItem.Time;
|
||||
Assert.True(lower <= date);
|
||||
Assert.True(date <= higher);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsImagesAsync()
|
||||
{
|
||||
// Get config
|
||||
await TMDbClient.GetConfigAsync();
|
||||
|
||||
// Get images
|
||||
ProfileImages images = await TMDbClient.GetPersonImagesAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Profiles);
|
||||
Assert.Equal(IdHelper.BruceWillis, images.Id);
|
||||
ImageData image = images.Profiles.Single(s => s.FilePath == "/cPP5y15p6iU83MxQ3tEcbr5hqNR.jpg");
|
||||
await Verify(image);
|
||||
|
||||
// Test image url generator
|
||||
await TestImagesHelpers.TestImagesAsync(TestConfig, images);
|
||||
|
||||
ImageData image = images.Profiles.SingleOrDefault(s => s.FilePath == "/kI1OluWhLJk3pnR19VjOfABpnTY.jpg");
|
||||
|
||||
Assert.NotNull(image);
|
||||
Assert.True(Math.Abs(0.666666666666667 - image.AspectRatio) < double.Epsilon);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(image.FilePath), "image.FilePath was not a valid image path, was: " + image.FilePath);
|
||||
Assert.Equal(1500, image.Height);
|
||||
Assert.Null(image.Iso_639_1);
|
||||
Assert.Equal(1000, image.Width);
|
||||
Assert.True(image.VoteAverage > 0);
|
||||
Assert.True(image.VoteCount > 0);
|
||||
TestImagesHelpers.TestImagePaths(images.Profiles);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsTaggedImagesAsync()
|
||||
{
|
||||
// Get config
|
||||
await TMDbClient.GetConfigAsync();
|
||||
|
||||
// Get images
|
||||
await TestHelpers.SearchPagesAsync<SearchContainerWithId<TaggedImage>, TaggedImage>(i => TMDbClient.GetPersonTaggedImagesAsync(IdHelper.BruceWillis, i));
|
||||
|
||||
SearchContainer<TaggedImage> images = await TMDbClient.GetPersonTaggedImagesAsync(IdHelper.BruceWillis, 1);
|
||||
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Results);
|
||||
Assert.NotEmpty(images.Results);
|
||||
|
||||
TaggedImage image = images.Results.SingleOrDefault(s => s.FilePath == "/my81Hjt7NpZhaMX9bHi4wVhFy0v.jpg");
|
||||
TestImagesHelpers.TestImagePaths(images.Results);
|
||||
|
||||
Assert.NotNull(image);
|
||||
Assert.True(Math.Abs(1.77777777777778 - image.AspectRatio) < double.Epsilon);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(image.FilePath), "image.FilePath was not a valid image path, was: " + image.FilePath);
|
||||
Assert.Equal(1080, image.Height);
|
||||
Assert.Equal("4ea5d0792c058837cb000431", image.Id);
|
||||
Assert.Null(image.Iso_639_1);
|
||||
Assert.True(image.VoteAverage > 0);
|
||||
Assert.True(image.VoteCount > 0);
|
||||
Assert.Equal(1920, image.Width);
|
||||
Assert.Equal("backdrop", image.ImageType);
|
||||
Assert.Equal(MediaType.Movie, image.MediaType);
|
||||
TaggedImage image = images.Results.Single(s => s.FilePath == "/svIDTNUoajS8dLEo7EosxvyAsgJ.jpg");
|
||||
|
||||
Assert.NotNull(image.Media);
|
||||
Assert.IsType<SearchMovie>(image.Media);
|
||||
|
||||
SearchMovie mediaBase = (SearchMovie)image.Media;
|
||||
Assert.False(mediaBase.Adult);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(mediaBase.BackdropPath), "image.Media.BackdropPath was not a valid image path, was: " + mediaBase.BackdropPath);
|
||||
Assert.Equal(187, mediaBase.Id);
|
||||
Assert.Equal("en", mediaBase.OriginalLanguage);
|
||||
Assert.Equal("Sin City", mediaBase.OriginalTitle);
|
||||
Assert.Equal("Welcome to Sin City. This town beckons to the tough, the corrupt, the brokenhearted. Some call it dark… Hard-boiled. Then there are those who call it home — Crooked cops, sexy dames, desperate vigilantes. Some are seeking revenge, others lust after redemption, and then there are those hoping for a little of both. A universe of unlikely and reluctant heroes still trying to do the right thing in a city that refuses to care.", mediaBase.Overview);
|
||||
Assert.Equal(new DateTime(2005, 3, 31), mediaBase.ReleaseDate);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(mediaBase.PosterPath), "image.Media.PosterPath was not a valid image path, was: " + mediaBase.PosterPath);
|
||||
Assert.True(mediaBase.Popularity > 0);
|
||||
Assert.Equal("Sin City", mediaBase.Title);
|
||||
Assert.False(mediaBase.Video);
|
||||
Assert.True(mediaBase.VoteAverage > 0);
|
||||
Assert.True(mediaBase.VoteCount > 0);
|
||||
|
||||
Assert.NotNull(mediaBase.GenreIds);
|
||||
Assert.Equal(3, mediaBase.GenreIds.Count);
|
||||
Assert.Contains(28, mediaBase.GenreIds);
|
||||
Assert.Contains(53, mediaBase.GenreIds);
|
||||
Assert.Contains(80, mediaBase.GenreIds);
|
||||
await Verify(image);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -345,24 +148,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
SearchContainer<PersonResult> list = await TMDbClient.GetPersonListAsync(type);
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainer<PersonResult> listPage2 = await TMDbClient.GetPersonListAsync(type, 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainer<PersonResult> list2 = await TMDbClient.GetPersonListAsync(type);
|
||||
|
||||
Assert.NotNull(list2);
|
||||
Assert.True(list2.Results.Count > 0);
|
||||
Assert.Equal(1, list2.Page);
|
||||
|
||||
// At least one person should differ
|
||||
Assert.Contains(list.Results, s => list2.Results.Any(x => x.Name != s.Name));
|
||||
Assert.NotEmpty(list.Results);
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,15 +156,16 @@ namespace TMDbLibTests
|
||||
public async Task TestGetLatestPersonAsync()
|
||||
{
|
||||
Person item = await TMDbClient.GetLatestPersonAsync();
|
||||
|
||||
Assert.NotNull(item);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestGetTranslatedPersonAsync()
|
||||
{
|
||||
Person person = await TMDbClient.GetPersonAsync(1019, "da");
|
||||
Assert.NotNull(person);
|
||||
Assert.Equal("Mads Dittmann Mikkelsen, der er søn af fuldmægtig Henning Mikkelsen og hustru sygehjælper Bente Christiansen, voksede op på Nørrebro i København. I 11 år var han gymnast og gymnastikinstruktør i Gymnastikforeningen Gefion. Efter studentereksamen tilmeldte han sig et dansekursus for arbejdsløse. Det blev siden til otte års professionelt engagement i danseensemblet Mikado og han var to gange på Martha Grahams sommerskole i New York. Senere blev han også vikar for Vicky Leander på Daghøjskolen for dansk, drama og musik. Han blev skuespilleruddannet fra Århus Teaterskole i 1996 og debuterede som førsteelsker i \"Kunst\" på Århus Teater. Mads Mikkelsen har bl.a. stået på scenen i \"Paradis\" (1997), \"Længe siden\" (1999) og \"Fiaskospiralen\" (1999) på Dr. Dante’s Aveny samt \"Romeo og Julie\" (1998) på Østre Gasværk. Han filmdebuterede allerede i 1995 med en af hovedrollerne i novellefilmen \"Blomsterfangen\" I 1996 fik han sit store kunstneriske filmgennembrud som den kronragede slyngel Tonny i den banebrydende og meget rå film \"Pusher\". Han havde den ene af hovedrollerne i den danske film \"Vildspor\", rollen som Lenny i \"Bleeder\" og huskes som den våbengale Arne i Anders Thomas Jensens første spillefilm \"Blinkende Lygter\" (2000), der blev det helt store biografhit. I 2001 fik han også fænomenal succes i Hella Joofs biograffilm \"En kort, en lang\", hvor han spillede bøssen Jacob over for Troels Lyby. Siden 2005 har han haft international succes i film som \"King Arthur\" og især som storskurken Le Chiffre i James Bond- filmen \"Casino Royale\" fra 2006. I DR\'s politiserie \"Rejseholdet\" fik han sit folkelige gennembrud som politimanden Allan Fischer. Han er bror til skuespilleren Lars Mikkelsen. Mads Mikkelsen blev den 2. december 2000 gift med danserinde og koreograf Hanne Jacobsen (13-01-1961) og sammen har de to børn.", person.Biography);
|
||||
Person person = await TMDbClient.GetPersonAsync(IdHelper.BruceWillis, "da");
|
||||
|
||||
await Verify(person);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Reviews;
|
||||
using TMDbLib.Objects.General;
|
||||
using TMDbLibTests.Helpers;
|
||||
using TMDbLibTests.JsonHelpers;
|
||||
|
||||
@ -14,15 +13,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
Review review = await TMDbClient.GetReviewAsync(IdHelper.TheDarkKnightRisesReviewId);
|
||||
|
||||
Assert.NotNull(review);
|
||||
|
||||
Assert.Equal(IdHelper.TheDarkKnightRisesReviewId, review.Id);
|
||||
Assert.Equal(49026, review.MediaId);
|
||||
Assert.Equal("The Dark Knight Rises", review.MediaTitle);
|
||||
Assert.Equal("Travis Bell", review.Author);
|
||||
Assert.Equal("en", review.Iso_639_1);
|
||||
Assert.Equal("https://www.themoviedb.org/review/5010553819c2952d1b000451", review.Url);
|
||||
Assert.Equal(MediaType.Movie, review.MediaType);
|
||||
await Verify(review);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.General;
|
||||
using TMDbLib.Objects.Search;
|
||||
using System.Linq;
|
||||
@ -18,30 +17,12 @@ namespace TMDbLibTests
|
||||
|
||||
// Search pr. Year
|
||||
// 1962: First James Bond movie, "Dr. No"
|
||||
SearchContainer<SearchMovie> result = await TMDbClient.SearchMovieAsync("007", year: 1962);
|
||||
SearchContainer<SearchMovie> result = await TMDbClient.SearchMovieAsync("007", year: 1962);
|
||||
SearchMovie item = result.Results.Single(s => s.Id == 646);
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchMovie item = result.Results.SingleOrDefault(s => s.Id == 646);
|
||||
await Verify(item);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(646, item.Id);
|
||||
Assert.False(item.Adult);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.BackdropPath), "item.BackdropPath was not a valid image path, was: " + item.BackdropPath);
|
||||
Assert.Equal("en", item.OriginalLanguage);
|
||||
Assert.Equal("Dr. No", item.OriginalTitle);
|
||||
Assert.Equal("In the film that launched the James Bond saga, Agent 007 battles mysterious Dr. No, a scientific genius bent on destroying the U.S. space program. As the countdown to disaster begins, Bond must go to Jamaica, where he encounters beautiful Honey Ryder, to confront a megalomaniacal villain in his massive island headquarters.", item.Overview);
|
||||
Assert.False(item.Video);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.PosterPath), "item.PosterPath was not a valid image path, was: " + item.PosterPath);
|
||||
Assert.Equal(new DateTime(1962, 10, 4), item.ReleaseDate);
|
||||
Assert.Equal("Dr. No", item.Title);
|
||||
Assert.True(item.Popularity > 0);
|
||||
Assert.True(item.VoteAverage > 0);
|
||||
Assert.True(item.VoteCount > 0);
|
||||
|
||||
Assert.NotNull(item.GenreIds);
|
||||
Assert.Contains(12, item.GenreIds);
|
||||
Assert.Contains(28, item.GenreIds);
|
||||
Assert.Contains(53, item.GenreIds);
|
||||
TestImagesHelpers.TestImagePaths(new[] { item.BackdropPath, item.PosterPath });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -50,15 +31,11 @@ namespace TMDbLibTests
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchCollectionAsync("007", i));
|
||||
|
||||
SearchContainer<SearchCollection> result = await TMDbClient.SearchCollectionAsync("James Bond");
|
||||
SearchCollection item = result.Results.Single(s => s.Id == 645);
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchCollection item = result.Results.SingleOrDefault(s => s.Id == 645);
|
||||
await Verify(item);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(645, item.Id);
|
||||
Assert.Equal("James Bond Collection", item.Name);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.BackdropPath), "item.BackdropPath was not a valid image path, was: " + item.BackdropPath);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.PosterPath), "item.PosterPath was not a valid image path, was: " + item.PosterPath);
|
||||
TestImagesHelpers.TestImagePaths(new[] { item.BackdropPath, item.PosterPath });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -67,40 +44,11 @@ namespace TMDbLibTests
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchPersonAsync("Willis", i));
|
||||
|
||||
SearchContainer<SearchPerson> result = await TMDbClient.SearchPersonAsync("Willis");
|
||||
SearchPerson item = result.Results.Single(s => s.Id == 62);
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchPerson item = result.Results.SingleOrDefault(s => s.Id == 62);
|
||||
await Verify(item);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(62, item.Id);
|
||||
Assert.Equal("Bruce Willis", item.Name);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.ProfilePath), "item.ProfilePath was not a valid image path, was: " + item.ProfilePath);
|
||||
Assert.False(item.Adult);
|
||||
Assert.True(item.Popularity > 0);
|
||||
|
||||
Assert.NotNull(item.KnownFor);
|
||||
Assert.Contains(item.KnownFor, s => s.Id == 680);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestSearchListAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchListAsync("to watch", i));
|
||||
|
||||
SearchContainer<SearchList> result = await TMDbClient.SearchListAsync("to watch");
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchList item = result.Results.SingleOrDefault(s => s.Id == "54a5c0ceaed56c28c300013a");
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal("to watch", item.Description);
|
||||
Assert.Equal("54a5c0ceaed56c28c300013a", item.Id);
|
||||
Assert.Equal("en", item.Iso_639_1);
|
||||
Assert.Equal("movie", item.ListType);
|
||||
Assert.Equal("Movies", item.Name);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.PosterPath), "item.PosterPath was not a valid image path, was: " + item.PosterPath);
|
||||
Assert.True(item.FavoriteCount > 0);
|
||||
Assert.True(item.ItemCount > 0);
|
||||
TestImagesHelpers.TestImagePaths(new[] { item.ProfilePath });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -109,14 +57,11 @@ namespace TMDbLibTests
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchCompanyAsync("20th", i));
|
||||
|
||||
SearchContainer<SearchCompany> result = await TMDbClient.SearchCompanyAsync("20th");
|
||||
SearchCompany item = result.Results.Single(s => s.Id == 25);
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchCompany item = result.Results.SingleOrDefault(s => s.Id == 25);
|
||||
await Verify(item);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(25, item.Id);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.LogoPath), "item.LogoPath was not a valid image path, was: " + item.LogoPath);
|
||||
Assert.Equal("20th Century Fox", item.Name);
|
||||
TestImagesHelpers.TestImagePaths(new[] { item.LogoPath });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -125,13 +70,9 @@ namespace TMDbLibTests
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchKeywordAsync("plot", i));
|
||||
|
||||
SearchContainer<SearchKeyword> result = await TMDbClient.SearchKeywordAsync("plot");
|
||||
SearchKeyword item = result.Results.Single(s => s.Id == 11121);
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchKeyword item = result.Results.SingleOrDefault(s => s.Id == 11121);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(11121, item.Id);
|
||||
Assert.Equal("plot", item.Name);
|
||||
await Verify(item);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -140,30 +81,11 @@ namespace TMDbLibTests
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchTvShowAsync("Breaking Bad", i));
|
||||
|
||||
SearchContainer<SearchTv> result = await TMDbClient.SearchTvShowAsync("Breaking Bad");
|
||||
SearchTv item = result.Results.Single(s => s.Id == 1396);
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchTv item = result.Results.SingleOrDefault(s => s.Id == 1396);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(1396, item.Id);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.BackdropPath), "item.BackdropPath was not a valid image path, was: " + item.BackdropPath);
|
||||
Assert.Equal(new DateTime(2008, 1, 19), item.FirstAirDate);
|
||||
Assert.Equal("Breaking Bad", item.Name);
|
||||
Assert.Equal("Breaking Bad", item.OriginalName);
|
||||
Assert.Equal("en", item.OriginalLanguage);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.PosterPath), "item.PosterPath was not a valid image path, was: " + item.PosterPath);
|
||||
Assert.Equal("Breaking Bad is an American crime drama television series created and produced by Vince Gilligan. Set and produced in Albuquerque, New Mexico, Breaking Bad is the story of Walter White, a struggling high school chemistry teacher who is diagnosed with inoperable lung cancer at the beginning of the series. He turns to a life of crime, producing and selling methamphetamine, in order to secure his family's financial future before he dies, teaming with his former student, Jesse Pinkman. Heavily serialized, the series is known for positioning its characters in seemingly inextricable corners and has been labeled a contemporary western by its creator.", item.Overview);
|
||||
Assert.True(item.Popularity > 0);
|
||||
Assert.True(item.VoteAverage > 0);
|
||||
Assert.True(item.VoteCount > 0);
|
||||
|
||||
Assert.NotNull(item.GenreIds);
|
||||
Assert.Single(item.GenreIds);
|
||||
Assert.Equal(18, item.GenreIds[0]);
|
||||
|
||||
Assert.NotNull(item.OriginCountry);
|
||||
Assert.Single(item.OriginCountry);
|
||||
Assert.Equal("US", item.OriginCountry[0]);
|
||||
await Verify(item);
|
||||
|
||||
TestImagesHelpers.TestImagePaths(new[] { item.BackdropPath, item.PosterPath });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -172,25 +94,11 @@ namespace TMDbLibTests
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchMultiAsync("Arrow", i));
|
||||
|
||||
SearchContainer<SearchBase> result = await TMDbClient.SearchMultiAsync("Arrow");
|
||||
SearchTv item = result.Results.OfType<SearchTv>().Single(s => s.Id == 1412);
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchTv item = result.Results.OfType<SearchTv>().SingleOrDefault(s => s.Id == 1412);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(1412, item.Id);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.BackdropPath), "item.BackdropPath was not a valid image path, was: " + item.BackdropPath);
|
||||
Assert.Equal(new DateTime(2012, 10, 10), item.FirstAirDate);
|
||||
Assert.Equal(MediaType.Tv, item.MediaType);
|
||||
Assert.Equal("Arrow", item.Name);
|
||||
Assert.Equal("Arrow", item.OriginalName);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.PosterPath), "item.PosterPath was not a valid image path, was: " + item.PosterPath);
|
||||
Assert.True(item.Popularity > 0);
|
||||
Assert.True(item.VoteAverage > 0);
|
||||
Assert.True(item.VoteCount > 0);
|
||||
|
||||
Assert.NotNull(item.OriginCountry);
|
||||
Assert.Single(item.OriginCountry);
|
||||
Assert.Contains("US", item.OriginCountry);
|
||||
await Verify(item);
|
||||
|
||||
TestImagesHelpers.TestImagePaths(new[] { item.BackdropPath, item.PosterPath });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace TMDbLibTests
|
||||
await TMDbClient.GetConfigAsync();
|
||||
Assert.True(TMDbClient.HasConfig);
|
||||
|
||||
Assert.NotNull(TMDbClient.Config);
|
||||
await Verify(TMDbClient.Config);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -31,7 +31,7 @@ namespace TMDbLibTests
|
||||
await config.Client.GetConfigAsync();
|
||||
Assert.True(config.Client.HasConfig);
|
||||
|
||||
Assert.NotNull(config.Client.Config);
|
||||
await Verify(config.Client.Config);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -75,17 +75,28 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public void ClientSetBadMaxRetryValue()
|
||||
{
|
||||
TMDbClient client = new TMDbClient(TestConfig.APIKey);
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => client.MaxRetryCount = -1);
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => TMDbClient.MaxRetryCount = -1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ClientTestUrlGenerator()
|
||||
{
|
||||
await TMDbClient.GetConfigAsync();
|
||||
|
||||
Uri uri = TMDbClient.GetImageUrl("w92", "/2B7RySy2WMVJKKEFN2XA3IFb8w0.jpg");
|
||||
Uri uriSsl = TMDbClient.GetImageUrl("w92", "/2B7RySy2WMVJKKEFN2XA3IFb8w0.jpg", true);
|
||||
|
||||
await Verify(new
|
||||
{
|
||||
uri,
|
||||
uriSsl
|
||||
});
|
||||
}
|
||||
|
||||
[Fact(Skip = "Disabled till we can consistently reproduce a rate limit")]
|
||||
public async Task ClientRateLimitTest()
|
||||
{
|
||||
const int id = IdHelper.AGoodDayToDieHard;
|
||||
|
||||
TMDbClient client = new TMDbClient(TestConfig.APIKey);
|
||||
TMDbClient client = TMDbClient;
|
||||
client.MaxRetryCount = 0;
|
||||
|
||||
await Assert.ThrowsAsync<RequestLimitExceededException>(async () =>
|
||||
@ -94,7 +105,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
List<Task> tasks = new List<Task>(100);
|
||||
for (int i = 0; i < 100; i++)
|
||||
tasks.Add(client.GetMovieAsync(id));
|
||||
tasks.Add(client.GetMovieAsync(IdHelper.AGoodDayToDieHard));
|
||||
|
||||
await Task.WhenAll(tasks);
|
||||
}
|
||||
|
@ -13,21 +13,21 @@ namespace TMDbLibTests
|
||||
public async Task TestTrendingMoviesAsync()
|
||||
{
|
||||
SearchContainer<SearchMovie> movies = await TMDbClient.GetTrendingMoviesAsync(TimeWindow.Week);
|
||||
Assert.True(movies.Results.Count > 0);
|
||||
Assert.NotEmpty(movies.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTrendingTvAsync()
|
||||
{
|
||||
SearchContainer<SearchTv> tv = await TMDbClient.GetTrendingTvAsync(TimeWindow.Week);
|
||||
Assert.True(tv.Results.Count > 0);
|
||||
Assert.NotEmpty(tv.Results);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTrendingPeopleAsync()
|
||||
{
|
||||
SearchContainer<SearchPerson> people = await TMDbClient.GetTrendingPeopleAsync(TimeWindow.Week);
|
||||
Assert.True(people.Results.Count > 0);
|
||||
Assert.NotEmpty(people.Results);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using TMDbLib.Objects.TvShows;
|
||||
using TMDbLibTests.JsonHelpers;
|
||||
using Xunit;
|
||||
@ -9,20 +8,11 @@ namespace TMDbLibTests
|
||||
public class ClientTvEpisodeGroupTests : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void TestTvEpisodeGroups()
|
||||
public async Task TestTvEpisodeGroups()
|
||||
{
|
||||
Task<TvGroupCollection> group = TMDbClient.GetTvEpisodeGroupsAsync("5acf93e60e0a26346d0000ce");
|
||||
TvGroupCollection group = await TMDbClient.GetTvEpisodeGroupsAsync("5acf93e60e0a26346d0000ce");
|
||||
|
||||
Assert.Equal("5acf93e60e0a26346d0000ce", group.Result.Id);
|
||||
Assert.Equal("Netflix Collections", group.Result.Name);
|
||||
Assert.Equal("Netflix", group.Result.Network.Name);
|
||||
Assert.Equal("Comedians in Cars organized in Netflix's collections.", group.Result.Description);
|
||||
Assert.Equal(71, group.Result.EpisodeCount);
|
||||
Assert.Equal(5, group.Result.GroupCount);
|
||||
Assert.Equal(TvGroupType.Digital, group.Result.Type);
|
||||
|
||||
Assert.Equal("5acf93efc3a368739a0000a9", group.Result.Groups.First().Id);
|
||||
Assert.Equal(1078262, group.Result.Groups.First().Episodes.First().Id);
|
||||
await Verify(group);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Authentication;
|
||||
@ -16,11 +15,11 @@ namespace TMDbLibTests
|
||||
{
|
||||
public class ClientTvEpisodeTests : TestBase
|
||||
{
|
||||
private static Dictionary<TvEpisodeMethods, Func<TvEpisode, object>> _methods;
|
||||
private static readonly Dictionary<TvEpisodeMethods, Func<TvEpisode, object>> Methods;
|
||||
|
||||
public ClientTvEpisodeTests()
|
||||
static ClientTvEpisodeTests()
|
||||
{
|
||||
_methods = new Dictionary<TvEpisodeMethods, Func<TvEpisode, object>>
|
||||
Methods = new Dictionary<TvEpisodeMethods, Func<TvEpisode, object>>
|
||||
{
|
||||
[TvEpisodeMethods.Credits] = tvEpisode => tvEpisode.Credits,
|
||||
[TvEpisodeMethods.Images] = tvEpisode => tvEpisode.Images,
|
||||
@ -35,10 +34,10 @@ namespace TMDbLibTests
|
||||
{
|
||||
TvEpisode tvEpisode = await TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1);
|
||||
|
||||
TestBreakingBadSeasonOneEpisodeOneBaseProperties(tvEpisode);
|
||||
await Verify(tvEpisode);
|
||||
|
||||
// Test all extras, ensure none of them are populated
|
||||
foreach (Func<TvEpisode, object> selector in _methods.Values)
|
||||
foreach (Func<TvEpisode, object> selector in Methods.Values)
|
||||
{
|
||||
Assert.Null(selector(tvEpisode));
|
||||
}
|
||||
@ -61,9 +60,7 @@ namespace TMDbLibTests
|
||||
episode = await TMDbClient.GetTvEpisodeAsync(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates);
|
||||
}
|
||||
|
||||
Assert.NotNull(episode.AccountStates);
|
||||
Assert.True(episode.AccountStates.Rating.HasValue);
|
||||
Assert.True(Math.Abs(episode.AccountStates.Rating.Value - 5) < double.Epsilon);
|
||||
await Verify(episode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -72,16 +69,11 @@ namespace TMDbLibTests
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Account states will only show up if we've done something
|
||||
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5);
|
||||
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.FullerHouse, 1, 1, 5);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, combined),
|
||||
tvEpisode =>
|
||||
await TestMethodsHelper.TestGetAll(Methods, combined => TMDbClient.GetTvEpisodeAsync(IdHelper.FullerHouse, 1, 1, combined), async tvEpisode =>
|
||||
{
|
||||
TestBreakingBadSeasonOneEpisodeOneBaseProperties(tvEpisode);
|
||||
|
||||
Assert.NotNull(tvEpisode.Images);
|
||||
Assert.NotNull(tvEpisode.Images.Stills);
|
||||
Assert.True(tvEpisode.Images.Stills.Count > 0);
|
||||
await Verify(tvEpisode);
|
||||
});
|
||||
}
|
||||
|
||||
@ -89,7 +81,7 @@ namespace TMDbLibTests
|
||||
public async Task TestTvEpisodeExtrasExclusiveAsync()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, extras));
|
||||
await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -99,28 +91,15 @@ namespace TMDbLibTests
|
||||
Assert.NotNull(credits);
|
||||
|
||||
Cast guestStarItem = credits.GuestStars.FirstOrDefault(s => s.Id == 92495);
|
||||
Assert.Equal(92495, guestStarItem.Id);
|
||||
Assert.Equal("Emilio Koyama", guestStarItem.Character);
|
||||
Assert.Equal("52542273760ee3132800068e", guestStarItem.CreditId);
|
||||
Assert.Equal("John Koyama", guestStarItem.Name);
|
||||
Assert.NotNull(guestStarItem.ProfilePath);
|
||||
Assert.Equal(1, guestStarItem.Order);
|
||||
|
||||
Cast castItem = credits.Cast.FirstOrDefault(s => s.Id == 17419);
|
||||
Assert.Equal(17419, castItem.Id);
|
||||
Assert.Equal("Walter White", castItem.Character);
|
||||
Assert.Equal("52542282760ee313280017f9", castItem.CreditId);
|
||||
Assert.Equal("Bryan Cranston", castItem.Name);
|
||||
Assert.NotNull(castItem.ProfilePath);
|
||||
Assert.Equal(0, castItem.Order);
|
||||
|
||||
Crew crewItem = credits.Crew.FirstOrDefault(s => s.Id == 1280071);
|
||||
Assert.NotNull(crewItem);
|
||||
Assert.Equal(1280071, crewItem.Id);
|
||||
Assert.Equal("Editing", crewItem.Department);
|
||||
Assert.Equal("Lynne Willingham", crewItem.Name);
|
||||
Assert.Equal("Editor", crewItem.Job);
|
||||
Assert.Null(crewItem.ProfilePath);
|
||||
|
||||
await Verify(new
|
||||
{
|
||||
guestStarItem,
|
||||
castItem,
|
||||
crewItem
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -128,29 +107,23 @@ namespace TMDbLibTests
|
||||
{
|
||||
ExternalIdsTvEpisode externalIds = await TMDbClient.GetTvEpisodeExternalIdsAsync(IdHelper.BreakingBad, 1, 1);
|
||||
|
||||
Assert.NotNull(externalIds);
|
||||
Assert.True(string.IsNullOrEmpty(externalIds.FreebaseId));
|
||||
Assert.Equal(62085, externalIds.Id);
|
||||
Assert.Equal("/m/03mb620", externalIds.FreebaseMid);
|
||||
Assert.Equal("tt0959621", externalIds.ImdbId);
|
||||
Assert.Equal("637041", externalIds.TvrageId);
|
||||
Assert.Equal("349232", externalIds.TvdbId);
|
||||
await Verify(externalIds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeSeparateExtrasImagesAsync()
|
||||
{
|
||||
StillImages images = await TMDbClient.GetTvEpisodeImagesAsync(IdHelper.BreakingBad, 1, 1);
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Stills);
|
||||
|
||||
await Verify(images);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeSeparateExtrasVideosAsync()
|
||||
{
|
||||
ResultContainer<Video> images = await TMDbClient.GetTvEpisodeVideosAsync(IdHelper.BreakingBad, 1, 1);
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Results);
|
||||
|
||||
await Verify(images);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -202,45 +175,11 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeGetChangesAsync()
|
||||
{
|
||||
ChangesContainer changes = await TMDbClient.GetTvEpisodeChangesAsync(IdHelper.BreakingBadSeason1Episode1Id);
|
||||
IList<Change> changes = await TMDbClient.GetTvEpisodeChangesAsync(IdHelper.BreakingBadSeason1Episode1Id);
|
||||
|
||||
Assert.NotEmpty(changes);
|
||||
|
||||
Assert.NotNull(changes);
|
||||
Assert.NotNull(changes.Changes);
|
||||
}
|
||||
|
||||
private void TestBreakingBadSeasonOneEpisodeOneBaseProperties(TvEpisode tvEpisode)
|
||||
{
|
||||
Assert.Equal(62085, tvEpisode.Id);
|
||||
Assert.True(tvEpisode.AirDate.HasValue);
|
||||
Assert.Equal(new DateTime(2008, 1, 19), tvEpisode.AirDate.Value.Date);
|
||||
Assert.Equal(1, tvEpisode.EpisodeNumber);
|
||||
Assert.Equal("Pilot", tvEpisode.Name);
|
||||
Assert.NotNull(tvEpisode.Overview);
|
||||
Assert.Null(tvEpisode.ProductionCode);
|
||||
Assert.Equal(1, tvEpisode.SeasonNumber);
|
||||
Assert.NotNull(tvEpisode.StillPath);
|
||||
|
||||
Assert.NotNull(tvEpisode.Crew);
|
||||
Crew crew = tvEpisode.Crew.SingleOrDefault(s => s.CreditId == "52542275760ee313280006ce");
|
||||
Assert.NotNull(crew);
|
||||
|
||||
Assert.Equal(66633, crew.Id);
|
||||
Assert.Equal("52542275760ee313280006ce", crew.CreditId);
|
||||
Assert.Equal("Vince Gilligan", crew.Name);
|
||||
Assert.Equal("Writing", crew.Department);
|
||||
Assert.Equal("Writer", crew.Job);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(crew.ProfilePath), "crew.ProfilePath was not a valid image path, was: " + crew.ProfilePath);
|
||||
|
||||
Assert.NotNull(tvEpisode.GuestStars);
|
||||
Cast star = tvEpisode.GuestStars.SingleOrDefault(s => s.CreditId == "52542273760ee3132800068e");
|
||||
Assert.NotNull(star);
|
||||
|
||||
Assert.Equal(92495, star.Id);
|
||||
Assert.Equal("John Koyama", star.Name);
|
||||
Assert.Equal("52542273760ee3132800068e", star.CreditId);
|
||||
Assert.Equal("Emilio Koyama", star.Character);
|
||||
Assert.Equal(1, star.Order);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(star.ProfilePath), "star.ProfilePath was not a valid image path, was: " + star.ProfilePath);
|
||||
await Verify(changes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -255,13 +194,9 @@ namespace TMDbLibTests
|
||||
public async Task TestTvEpisodesScreenedTheatricallyAsync()
|
||||
{
|
||||
ResultContainer<TvEpisodeInfo> results = await TMDbClient.GetTvEpisodesScreenedTheatricallyAsync(IdHelper.GameOfThrones);
|
||||
TvEpisodeInfo single = results.Results.Single(s => s.Id == IdHelper.GameOfThronesSeason4Episode10);
|
||||
|
||||
Assert.Equal(IdHelper.GameOfThrones, results.Id);
|
||||
|
||||
TvEpisodeInfo single = results.Results.FirstOrDefault(s => s.Id == 63103);
|
||||
Assert.NotNull(single);
|
||||
Assert.Equal(4, single.SeasonNumber);
|
||||
Assert.Equal(10, single.EpisodeNumber);
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -269,7 +204,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
TvEpisode resp = await TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, language: "en-US", includeImageLanguage: "en", extraMethods: TvEpisodeMethods.Images);
|
||||
|
||||
Assert.True(resp.Images.Stills.Count > 0);
|
||||
await Verify(resp.Images);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Authentication;
|
||||
@ -16,11 +15,11 @@ namespace TMDbLibTests
|
||||
{
|
||||
public class ClientTvSeasonTests : TestBase
|
||||
{
|
||||
private static Dictionary<TvSeasonMethods, Func<TvSeason, object>> _methods;
|
||||
private static readonly Dictionary<TvSeasonMethods, Func<TvSeason, object>> Methods;
|
||||
|
||||
public ClientTvSeasonTests()
|
||||
static ClientTvSeasonTests()
|
||||
{
|
||||
_methods = new Dictionary<TvSeasonMethods, Func<TvSeason, object>>
|
||||
Methods = new Dictionary<TvSeasonMethods, Func<TvSeason, object>>
|
||||
{
|
||||
[TvSeasonMethods.Credits] = tvSeason => tvSeason.Credits,
|
||||
[TvSeasonMethods.Images] = tvSeason => tvSeason.Images,
|
||||
@ -36,13 +35,11 @@ namespace TMDbLibTests
|
||||
{
|
||||
TvSeason tvSeason = await TMDbClient.GetTvSeasonAsync(IdHelper.BreakingBad, 1);
|
||||
|
||||
TestBreakingBadBaseProperties(tvSeason);
|
||||
await Verify(tvSeason);
|
||||
|
||||
// Test all extras, ensure none of them are populated
|
||||
foreach (Func<TvSeason, object> selector in _methods.Values)
|
||||
{
|
||||
foreach (Func<TvSeason, object> selector in Methods.Values)
|
||||
Assert.Null(selector(tvSeason));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -73,42 +70,25 @@ namespace TMDbLibTests
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Account states will only show up if we've done something
|
||||
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5);
|
||||
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.FullerHouse, 1, 1, 5);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetTvSeasonAsync(IdHelper.BreakingBad, 1, combined), TestBreakingBadBaseProperties);
|
||||
await TestMethodsHelper.TestGetAll(Methods, combined => TMDbClient.GetTvSeasonAsync(IdHelper.FullerHouse, 1, combined), season => Verify(season));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvSeasonExtrasExclusiveAsync()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetTvSeasonAsync(IdHelper.BreakingBad, 1, extras));
|
||||
|
||||
await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetTvSeasonAsync(IdHelper.BreakingBad, 1, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvSeasonSeparateExtrasCreditsAsync()
|
||||
{
|
||||
Credits credits = await TMDbClient.GetTvSeasonCreditsAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(credits);
|
||||
Assert.NotNull(credits.Cast);
|
||||
Assert.Equal("Walter White", credits.Cast[0].Character);
|
||||
Assert.Equal("52542282760ee313280017f9", credits.Cast[0].CreditId);
|
||||
Assert.Equal(17419, credits.Cast[0].Id);
|
||||
Assert.Equal("Bryan Cranston", credits.Cast[0].Name);
|
||||
Assert.NotNull(credits.Cast[0].ProfilePath);
|
||||
Assert.Equal(0, credits.Cast[0].Order);
|
||||
Assert.True(credits.Cast[0].Popularity > 0);
|
||||
Assert.Equal("Acting", credits.Cast[0].KnownForDepartment);
|
||||
Assert.Equal("Bryan Cranston", credits.Cast[0].OriginalName);
|
||||
|
||||
Crew crewPersonId = credits.Crew.FirstOrDefault(s => s.Id == 1223202);
|
||||
Assert.NotNull(crewPersonId);
|
||||
|
||||
Assert.Equal(1223202, crewPersonId.Id);
|
||||
Assert.Equal("Production", crewPersonId.Department);
|
||||
Assert.Equal("Diane Mercer", crewPersonId.Name);
|
||||
Assert.Equal("Producer", crewPersonId.Job);
|
||||
Assert.Null(crewPersonId.ProfilePath);
|
||||
await Verify(credits);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -116,28 +96,25 @@ namespace TMDbLibTests
|
||||
{
|
||||
ExternalIdsTvSeason externalIds = await TMDbClient.GetTvSeasonExternalIdsAsync(IdHelper.BreakingBad, 1);
|
||||
|
||||
Assert.NotNull(externalIds);
|
||||
Assert.Equal(3572, externalIds.Id);
|
||||
Assert.Equal("/en/breaking_bad_season_1", externalIds.FreebaseId);
|
||||
Assert.Equal("/m/05yy27m", externalIds.FreebaseMid);
|
||||
Assert.Null(externalIds.TvrageId);
|
||||
Assert.Equal("30272", externalIds.TvdbId);
|
||||
await Verify(externalIds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvSeasonSeparateExtrasImagesAsync()
|
||||
{
|
||||
PosterImages images = await TMDbClient.GetTvSeasonImagesAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Posters);
|
||||
|
||||
Assert.NotEmpty(images.Posters);
|
||||
TestImagesHelpers.TestImagePaths(images.Posters);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvSeasonSeparateExtrasVideosAsync()
|
||||
{
|
||||
ResultContainer<Video> videos = await TMDbClient.GetTvSeasonVideosAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(videos);
|
||||
Assert.NotNull(videos.Results);
|
||||
ResultContainer<Video> videos = await TMDbClient.GetTvSeasonVideosAsync(IdHelper.GameOfThrones, 1);
|
||||
Video single = videos.Results.Single(s => s.Id == "5c9b7e95c3a36841a341b9c6");
|
||||
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -145,64 +122,28 @@ namespace TMDbLibTests
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Rate episode 1, 2 and 3 of BreakingBad
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5));
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 2, 7));
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 3, 3));
|
||||
await TestMethodsHelper.SetValidateRemoveTest(
|
||||
() => TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 3, 5),
|
||||
() => TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 3),
|
||||
async shouldBeSet =>
|
||||
{
|
||||
ResultContainer<TvEpisodeAccountStateWithNumber> state = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1);
|
||||
|
||||
// Wait for TMDb to un-cache our value
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Fetch out the seasons state
|
||||
ResultContainer<TvEpisodeAccountStateWithNumber> state = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(state);
|
||||
|
||||
Assert.True(Math.Abs(5 - (state.Results.Single(s => s.EpisodeNumber == 1).Rating ?? 0)) < double.Epsilon);
|
||||
Assert.True(Math.Abs(7 - (state.Results.Single(s => s.EpisodeNumber == 2).Rating ?? 0)) < double.Epsilon);
|
||||
Assert.True(Math.Abs(3 - (state.Results.Single(s => s.EpisodeNumber == 3).Rating ?? 0)) < double.Epsilon);
|
||||
|
||||
// Test deleting Ratings
|
||||
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
|
||||
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 2));
|
||||
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 3));
|
||||
|
||||
// Wait for TMDb to un-cache our value
|
||||
await Task.Delay(2000);
|
||||
|
||||
state = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(state);
|
||||
|
||||
Assert.Null(state.Results.Single(s => s.EpisodeNumber == 1).Rating);
|
||||
Assert.Null(state.Results.Single(s => s.EpisodeNumber == 2).Rating);
|
||||
Assert.Null(state.Results.Single(s => s.EpisodeNumber == 3).Rating);
|
||||
if (shouldBeSet)
|
||||
Assert.Contains(state.Results, x => x.EpisodeNumber == 3 && x.Rating.HasValue);
|
||||
else
|
||||
Assert.Contains(state.Results, x => x.EpisodeNumber == 3 && !x.Rating.HasValue);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvSeasonGetChangesAsync()
|
||||
{
|
||||
ChangesContainer changes = await TMDbClient.GetTvSeasonChangesAsync(IdHelper.BreakingBadSeason1Id);
|
||||
Assert.NotNull(changes);
|
||||
Assert.NotNull(changes.Changes);
|
||||
}
|
||||
TvShow latestTvShow = await TMDbClient.GetLatestTvShowAsync();
|
||||
int latestSeasonId = latestTvShow.Seasons.Max(s => s.Id);
|
||||
IList<Change> changes = await TMDbClient.GetTvSeasonChangesAsync(latestSeasonId);
|
||||
|
||||
private void TestBreakingBadBaseProperties(TvSeason tvSeason)
|
||||
{
|
||||
Assert.NotNull(tvSeason);
|
||||
Assert.NotNull(tvSeason.Id);
|
||||
Assert.Equal(1, tvSeason.SeasonNumber);
|
||||
Assert.Equal("Season 1", tvSeason.Name);
|
||||
Assert.NotNull(tvSeason.AirDate);
|
||||
Assert.NotNull(tvSeason.Overview);
|
||||
Assert.NotNull(tvSeason.PosterPath);
|
||||
|
||||
Assert.NotNull(tvSeason.Episodes);
|
||||
Assert.Equal(7, tvSeason.Episodes.Count);
|
||||
Assert.Equal(1, tvSeason.Episodes[0].EpisodeNumber);
|
||||
Assert.Equal("Pilot", tvSeason.Episodes[0].Name);
|
||||
Assert.NotNull(tvSeason.Episodes[0].Overview);
|
||||
Assert.Null(tvSeason.Episodes[0].ProductionCode);
|
||||
Assert.Equal(1, tvSeason.Episodes[0].SeasonNumber);
|
||||
Assert.NotNull(tvSeason.Episodes[0].StillPath);
|
||||
Assert.NotEmpty(changes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -218,8 +159,9 @@ namespace TMDbLibTests
|
||||
{
|
||||
TvSeason resp = await TMDbClient.GetTvSeasonAsync(IdHelper.BreakingBad, 1, language: "en-US", includeImageLanguage: "en", extraMethods: TvSeasonMethods.Images);
|
||||
|
||||
Assert.True(resp.Images.Posters.Count > 0);
|
||||
Assert.True(resp.Images.Posters.All(p => p.Iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase)));
|
||||
ImageData poster = resp.Images.Posters.Single(s => s.FilePath == "/uFh3OrBvkwKSU3N5y0XnXOhqBJz.jpg");
|
||||
|
||||
await Verify(poster);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using TMDbLib.Objects.Authentication;
|
||||
@ -11,18 +10,17 @@ using TMDbLib.Objects.Search;
|
||||
using TMDbLib.Objects.TvShows;
|
||||
using TMDbLibTests.Helpers;
|
||||
using TMDbLibTests.JsonHelpers;
|
||||
using Cast = TMDbLib.Objects.TvShows.Cast;
|
||||
using Credits = TMDbLib.Objects.TvShows.Credits;
|
||||
|
||||
namespace TMDbLibTests
|
||||
{
|
||||
public class ClientTvShowTests : TestBase
|
||||
{
|
||||
private static Dictionary<TvShowMethods, Func<TvShow, object>> _methods;
|
||||
private static readonly Dictionary<TvShowMethods, Func<TvShow, object>> Methods;
|
||||
|
||||
public ClientTvShowTests()
|
||||
static ClientTvShowTests()
|
||||
{
|
||||
_methods = new Dictionary<TvShowMethods, Func<TvShow, object>>
|
||||
Methods = new Dictionary<TvShowMethods, Func<TvShow, object>>
|
||||
{
|
||||
[TvShowMethods.Credits] = tvShow => tvShow.Credits,
|
||||
[TvShowMethods.Images] = tvShow => tvShow.Images,
|
||||
@ -43,10 +41,10 @@ namespace TMDbLibTests
|
||||
{
|
||||
TvShow tvShow = await TMDbClient.GetTvShowAsync(IdHelper.BreakingBad);
|
||||
|
||||
TestBreakingBadBaseProperties(tvShow);
|
||||
await Verify(tvShow);
|
||||
|
||||
// Test all extras, ensure none of them are populated
|
||||
foreach (Func<TvShow, object> selector in _methods.Values)
|
||||
foreach (Func<TvShow, object> selector in Methods.Values)
|
||||
Assert.Null(selector(tvShow));
|
||||
}
|
||||
|
||||
@ -56,9 +54,9 @@ namespace TMDbLibTests
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Account states will only show up if we've done something
|
||||
await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
await TMDbClient.TvShowSetRatingAsync(IdHelper.KeepingUpAppearances, 5);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetTvShowAsync(IdHelper.BreakingBad, combined), TestBreakingBadBaseProperties);
|
||||
await TestMethodsHelper.TestGetAll(Methods, combined => TMDbClient.GetTvShowAsync(IdHelper.KeepingUpAppearances, combined), show => Verify(show));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -66,32 +64,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
Credits credits = await TMDbClient.GetTvShowCreditsAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.NotNull(credits);
|
||||
Assert.NotNull(credits.Cast);
|
||||
Assert.Equal(IdHelper.BreakingBad, credits.Id);
|
||||
|
||||
Cast castPerson = credits.Cast[0];
|
||||
Assert.Equal("Walter White", castPerson.Character);
|
||||
Assert.Equal("52542282760ee313280017f9", castPerson.CreditId);
|
||||
Assert.Equal(17419, castPerson.Id);
|
||||
Assert.Equal("Bryan Cranston", castPerson.Name);
|
||||
Assert.NotNull(castPerson.ProfilePath);
|
||||
Assert.Equal(0, castPerson.Order);
|
||||
Assert.True(castPerson.Popularity > 0);
|
||||
Assert.Equal("Acting", castPerson.KnownForDepartment);
|
||||
Assert.Equal("Bryan Cranston", castPerson.OriginalName);
|
||||
|
||||
Assert.NotNull(credits.Crew);
|
||||
|
||||
Crew crewPerson = credits.Crew.FirstOrDefault(s => s.Id == 66633);
|
||||
Assert.NotNull(crewPerson);
|
||||
|
||||
Assert.Equal(66633, crewPerson.Id);
|
||||
Assert.Equal("52542287760ee31328001af1", crewPerson.CreditId);
|
||||
Assert.Equal("Production", crewPerson.Department);
|
||||
Assert.Equal("Vince Gilligan", crewPerson.Name);
|
||||
Assert.Equal("Executive Producer", crewPerson.Job);
|
||||
Assert.NotNull(crewPerson.ProfilePath);
|
||||
await Verify(credits);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -99,85 +72,53 @@ namespace TMDbLibTests
|
||||
{
|
||||
ExternalIdsTvShow externalIds = await TMDbClient.GetTvShowExternalIdsAsync(IdHelper.GameOfThrones);
|
||||
|
||||
Assert.NotNull(externalIds);
|
||||
Assert.Equal(1399, externalIds.Id);
|
||||
Assert.Equal("/en/game_of_thrones", externalIds.FreebaseId);
|
||||
Assert.Equal("/m/0524b41", externalIds.FreebaseMid);
|
||||
Assert.Equal("tt0944947", externalIds.ImdbId);
|
||||
Assert.Equal("24493", externalIds.TvrageId);
|
||||
Assert.Equal("121361", externalIds.TvdbId);
|
||||
Assert.Equal("GameOfThrones", externalIds.FacebookId);
|
||||
Assert.Equal("GameOfThrones", externalIds.TwitterId);
|
||||
Assert.Equal("gameofthrones", externalIds.InstagramId);
|
||||
await Verify(externalIds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasContentRatingsAsync()
|
||||
{
|
||||
ResultContainer<ContentRating> contentRatings = await TMDbClient.GetTvShowContentRatingsAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(contentRatings);
|
||||
Assert.Equal(IdHelper.BreakingBad, contentRatings.Id);
|
||||
|
||||
ContentRating contentRating = contentRatings.Results.FirstOrDefault(r => r.Iso_3166_1.Equals("US"));
|
||||
Assert.NotNull(contentRating);
|
||||
Assert.Equal("TV-MA", contentRating.Rating);
|
||||
await Verify(contentRatings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasAlternativeTitlesAsync()
|
||||
{
|
||||
ResultContainer<AlternativeTitle> alternativeTitles = await TMDbClient.GetTvShowAlternativeTitlesAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(alternativeTitles);
|
||||
Assert.Equal(IdHelper.BreakingBad, alternativeTitles.Id);
|
||||
|
||||
AlternativeTitle alternativeTitle = alternativeTitles.Results.FirstOrDefault(r => r.Iso_3166_1.Equals("IT"));
|
||||
Assert.NotNull(alternativeTitle);
|
||||
Assert.Equal("Breaking Bad - Reazioni collaterali", alternativeTitle.Title);
|
||||
await Verify(alternativeTitles);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasKeywordsAsync()
|
||||
{
|
||||
ResultContainer<Keyword> keywords = await TMDbClient.GetTvShowKeywordsAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(keywords);
|
||||
Assert.Equal(IdHelper.BreakingBad, keywords.Id);
|
||||
|
||||
Keyword keyword = keywords.Results.FirstOrDefault(r => r.Id == 41525);
|
||||
Assert.NotNull(keyword);
|
||||
Assert.Equal("high school teacher", keyword.Name);
|
||||
Keyword single = keywords.Results.Single(s => s.Id == 15484);
|
||||
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasTranslationsAsync()
|
||||
{
|
||||
TranslationsContainerTv translations = await TMDbClient.GetTvShowTranslationsAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(translations);
|
||||
Assert.Equal(IdHelper.BreakingBad, translations.Id);
|
||||
|
||||
Translation translation = translations.Translations.FirstOrDefault(r => r.Iso_639_1 == "hr");
|
||||
Assert.NotNull(translation);
|
||||
Assert.Equal("Croatian", translation.EnglishName);
|
||||
Assert.Equal("hr", translation.Iso_639_1);
|
||||
Assert.Equal("Hrvatski", translation.Name);
|
||||
Translation single = translations.Translations.Single(s => s.Iso_3166_1 == "DK");
|
||||
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasVideosAsync()
|
||||
{
|
||||
ResultContainer<Video> videos = await TMDbClient.GetTvShowVideosAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(videos);
|
||||
Assert.Equal(IdHelper.BreakingBad, videos.Id);
|
||||
|
||||
Video video = videos.Results.FirstOrDefault(r => r.Id == "5759db2fc3a3683e7c003df7");
|
||||
Assert.NotNull(video);
|
||||
Video single = videos.Results.Single(s => s.Id == "5759db2fc3a3683e7c003df7");
|
||||
|
||||
Assert.Equal("5759db2fc3a3683e7c003df7", video.Id);
|
||||
Assert.Equal("en", video.Iso_639_1);
|
||||
Assert.Equal("XZ8daibM3AE", video.Key);
|
||||
Assert.Equal("Trailer", video.Name);
|
||||
Assert.Equal("YouTube", video.Site);
|
||||
Assert.Equal(720, video.Size);
|
||||
Assert.Equal("Trailer", video.Type);
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -206,93 +147,51 @@ namespace TMDbLibTests
|
||||
public async Task TestTvShowSeparateExtrasImagesAsync()
|
||||
{
|
||||
ImagesWithId images = await TMDbClient.GetTvShowImagesAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Backdrops);
|
||||
Assert.NotNull(images.Posters);
|
||||
|
||||
TestImagesHelpers.TestImagePaths(images);
|
||||
|
||||
ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/tsRy63Mu5cu8etL1X7ZLyf7UP1M.jpg");
|
||||
ImageData poster = images.Posters.Single(s => s.FilePath == "/ggFHVNu6YYI5L9pCfOacjizRGt.jpg");
|
||||
|
||||
await Verify(new
|
||||
{
|
||||
backdrop,
|
||||
poster
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowGetImagesWithImageLanguageAsync()
|
||||
{
|
||||
ImagesWithId resp = await TMDbClient.GetTvShowImagesAsync(IdHelper.BreakingBad, language: "en-US", includeImageLanguage: "en");
|
||||
ImagesWithId images = await TMDbClient.GetTvShowImagesAsync(IdHelper.BreakingBad, "en-US", "en");
|
||||
|
||||
Assert.True(resp.Backdrops.Count > 0);
|
||||
Assert.True(resp.Posters.Count > 0);
|
||||
TestImagesHelpers.TestImagePaths(images);
|
||||
|
||||
ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/otCnAN1edreRudT5E2OHk8beiDu.jpg");
|
||||
ImageData poster = images.Posters.Single(s => s.FilePath == "/ggFHVNu6YYI5L9pCfOacjizRGt.jpg");
|
||||
|
||||
await Verify(new
|
||||
{
|
||||
backdrop,
|
||||
poster
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowGetTvShowWithImageLanguageAsync()
|
||||
{
|
||||
TvShow resp = await TMDbClient.GetTvShowAsync(IdHelper.BreakingBad, language: "en-US", includeImageLanguage: "en", extraMethods: TvShowMethods.Images);
|
||||
TvShow resp = await TMDbClient.GetTvShowAsync(IdHelper.BreakingBad, includeImageLanguage: "pt", extraMethods: TvShowMethods.Images);
|
||||
|
||||
Assert.True(resp.Images.Backdrops.Count > 0);
|
||||
Assert.True(resp.Images.Backdrops.All(b => b.Iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase)));
|
||||
Assert.True(resp.Images.Posters.Count > 0);
|
||||
Assert.True(resp.Images.Posters.All(p => p.Iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase)));
|
||||
}
|
||||
TestImagesHelpers.TestImagePaths(resp.Images);
|
||||
|
||||
private void TestBreakingBadBaseProperties(TvShow tvShow)
|
||||
{
|
||||
Assert.NotNull(tvShow);
|
||||
Assert.Equal("Breaking Bad", tvShow.Name);
|
||||
Assert.Equal("Breaking Bad", tvShow.OriginalName);
|
||||
Assert.NotNull(tvShow.Overview);
|
||||
Assert.NotNull(tvShow.Homepage);
|
||||
Assert.Equal(new DateTime(2008, 01, 19), tvShow.FirstAirDate);
|
||||
Assert.Equal(new DateTime(2013, 9, 29), tvShow.LastAirDate);
|
||||
Assert.False(tvShow.InProduction);
|
||||
Assert.Equal("Ended", tvShow.Status);
|
||||
Assert.Equal("Scripted", tvShow.Type);
|
||||
Assert.Equal("en", tvShow.OriginalLanguage);
|
||||
ImageData backdrop = null;
|
||||
ImageData poster = resp.Images.Posters.Single(s => s.FilePath == "/30erzlzIOtOK3k3T3BAl1GiVMP1.jpg");
|
||||
|
||||
Assert.NotNull(tvShow.ProductionCompanies);
|
||||
Assert.Equal(3, tvShow.ProductionCompanies.Count);
|
||||
Assert.Equal(2605, tvShow.ProductionCompanies[0].Id);
|
||||
Assert.Equal("Gran Via Productions", tvShow.ProductionCompanies[0].Name);
|
||||
|
||||
Assert.NotNull(tvShow.CreatedBy);
|
||||
Assert.Single(tvShow.CreatedBy);
|
||||
Assert.Equal(66633, tvShow.CreatedBy[0].Id);
|
||||
Assert.Equal("Vince Gilligan", tvShow.CreatedBy[0].Name);
|
||||
|
||||
Assert.NotNull(tvShow.EpisodeRunTime);
|
||||
Assert.Equal(2, tvShow.EpisodeRunTime.Count);
|
||||
|
||||
Assert.NotNull(tvShow.Genres);
|
||||
Assert.Equal(18, tvShow.Genres[0].Id);
|
||||
Assert.Equal("Drama", tvShow.Genres[0].Name);
|
||||
|
||||
Assert.NotNull(tvShow.Languages);
|
||||
Assert.Equal("en", tvShow.Languages[0]);
|
||||
|
||||
Assert.Null(tvShow.NextEpisodeToAir);
|
||||
|
||||
Assert.NotNull(tvShow.LastEpisodeToAir);
|
||||
Assert.Equal(62161, tvShow.LastEpisodeToAir.Id);
|
||||
|
||||
Assert.NotNull(tvShow.Networks);
|
||||
Assert.Single(tvShow.Networks);
|
||||
Assert.Equal(174, tvShow.Networks[0].Id);
|
||||
Assert.Equal("AMC", tvShow.Networks[0].Name);
|
||||
|
||||
Assert.NotNull(tvShow.OriginCountry);
|
||||
Assert.Single(tvShow.OriginCountry);
|
||||
Assert.Equal("US", tvShow.OriginCountry[0]);
|
||||
|
||||
Assert.NotNull(tvShow.Seasons);
|
||||
Assert.Equal(6, tvShow.Seasons.Count);
|
||||
Assert.Equal(0, tvShow.Seasons[0].SeasonNumber);
|
||||
Assert.Equal(1, tvShow.Seasons[1].SeasonNumber);
|
||||
|
||||
Assert.Equal(62, tvShow.NumberOfEpisodes);
|
||||
Assert.Equal(5, tvShow.NumberOfSeasons);
|
||||
|
||||
Assert.NotNull(tvShow.PosterPath);
|
||||
Assert.NotNull(tvShow.BackdropPath);
|
||||
|
||||
Assert.NotEqual(0, tvShow.Popularity);
|
||||
Assert.NotEqual(0, tvShow.VoteAverage);
|
||||
Assert.NotEqual(0, tvShow.VoteAverage);
|
||||
await Verify(new
|
||||
{
|
||||
backdrop,
|
||||
poster
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -301,6 +200,8 @@ namespace TMDbLibTests
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetTvShowPopularAsync(i));
|
||||
|
||||
SearchContainer<SearchTv> result = await TMDbClient.GetTvShowPopularAsync();
|
||||
|
||||
Assert.NotEmpty(result.Results);
|
||||
Assert.NotNull(result.Results[0].Name);
|
||||
Assert.NotNull(result.Results[0].OriginalName);
|
||||
Assert.NotNull(result.Results[0].FirstAirDate);
|
||||
@ -311,25 +212,18 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSeasonCountAsync()
|
||||
{
|
||||
// TODO: Is this test obsolete?
|
||||
TvShow tvShow = await TMDbClient.GetTvShowAsync(1668);
|
||||
Assert.Equal(24, tvShow.Seasons[1].EpisodeCount);
|
||||
|
||||
await Verify(tvShow);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowVideosAsync()
|
||||
{
|
||||
TvShow tvShow = await TMDbClient.GetTvShowAsync(1668, TvShowMethods.Videos);
|
||||
Assert.NotNull(tvShow.Videos);
|
||||
Assert.NotNull(tvShow.Videos.Results);
|
||||
Assert.NotNull(tvShow.Videos.Results[0]);
|
||||
|
||||
Assert.Equal("552e1b53c3a3686c4e00207b", tvShow.Videos.Results[0].Id);
|
||||
Assert.Equal("en", tvShow.Videos.Results[0].Iso_639_1);
|
||||
Assert.Equal("lGTOru7pwL8", tvShow.Videos.Results[0].Key);
|
||||
Assert.Equal("Friends - Opening", tvShow.Videos.Results[0].Name);
|
||||
Assert.Equal("YouTube", tvShow.Videos.Results[0].Site);
|
||||
Assert.Equal(360, tvShow.Videos.Results[0].Size);
|
||||
Assert.Equal("Opening Credits", tvShow.Videos.Results[0].Type);
|
||||
await Verify(tvShow);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -348,87 +242,45 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowTranslationsAsync()
|
||||
{
|
||||
TranslationsContainerTv translations = await TMDbClient.GetTvShowTranslationsAsync(1668);
|
||||
TranslationsContainerTv translations = await TMDbClient.GetTvShowTranslationsAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.Equal(1668, translations.Id);
|
||||
Translation translation = translations.Translations.SingleOrDefault(s => s.Iso_639_1 == "hr");
|
||||
Assert.NotNull(translation);
|
||||
|
||||
Assert.Equal("Croatian", translation.EnglishName);
|
||||
Assert.Equal("hr", translation.Iso_639_1);
|
||||
Assert.Equal("Hrvatski", translation.Name);
|
||||
await Verify(translations);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSimilarsAsync()
|
||||
{
|
||||
SearchContainer<SearchTv> tvShow = await TMDbClient.GetTvShowSimilarAsync(1668);
|
||||
SearchContainer<SearchTv> tvShows = await TMDbClient.GetTvShowSimilarAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.NotNull(tvShow);
|
||||
Assert.NotNull(tvShow.Results);
|
||||
Assert.NotEmpty(tvShows.Results);
|
||||
|
||||
SearchTv item = tvShow.Results.SingleOrDefault(s => s.Id == 1100);
|
||||
Assert.NotNull(item);
|
||||
SearchTv tvShow = tvShows.Results.Single(s => s.Id == 63351);
|
||||
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.BackdropPath),
|
||||
"item.BackdropPath was not a valid image path, was: " + item.BackdropPath);
|
||||
Assert.Equal(1100, item.Id);
|
||||
Assert.Equal("How I Met Your Mother", item.OriginalName);
|
||||
Assert.Equal(new DateTime(2005, 09, 19), item.FirstAirDate);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.PosterPath),
|
||||
"item.PosterPath was not a valid image path, was: " + item.PosterPath);
|
||||
Assert.True(item.Popularity > 0);
|
||||
Assert.Equal("How I Met Your Mother", item.Name);
|
||||
Assert.True(item.VoteAverage > 0);
|
||||
Assert.True(item.VoteCount > 0);
|
||||
|
||||
Assert.NotNull(item.OriginCountry);
|
||||
Assert.Single(item.OriginCountry);
|
||||
Assert.Contains("US", item.OriginCountry);
|
||||
await Verify(tvShow);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowRecommendationsAsync()
|
||||
{
|
||||
SearchContainer<SearchTv> tvShow = await TMDbClient.GetTvShowRecommendationsAsync(1668);
|
||||
SearchContainer<SearchTv> tvShows = await TMDbClient.GetTvShowRecommendationsAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.NotNull(tvShow);
|
||||
Assert.NotNull(tvShow.Results);
|
||||
Assert.NotEmpty(tvShows.Results);
|
||||
|
||||
SearchTv item = tvShow.Results.SingleOrDefault(s => s.Id == 1100);
|
||||
Assert.NotNull(item);
|
||||
SearchTv tvShow = tvShows.Results.Single(s => s.Id == 63351);
|
||||
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.BackdropPath), "item.BackdropPath was not a valid image path, was: " + item.BackdropPath);
|
||||
Assert.Equal(1100, item.Id);
|
||||
Assert.Equal("How I Met Your Mother", item.OriginalName);
|
||||
Assert.Equal(new DateTime(2005, 09, 19), item.FirstAirDate);
|
||||
Assert.True(TestImagesHelpers.TestImagePath(item.PosterPath), "item.PosterPath was not a valid image path, was: " + item.PosterPath);
|
||||
Assert.Equal("How I Met Your Mother", item.Name);
|
||||
Assert.True(item.VoteAverage > 0);
|
||||
Assert.True(item.VoteCount > 0);
|
||||
|
||||
Assert.NotNull(item.OriginCountry);
|
||||
Assert.Single(item.OriginCountry);
|
||||
Assert.Contains("US", item.OriginCountry);
|
||||
await Verify(tvShow);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowTopRated()
|
||||
{
|
||||
// This test might fail with inconsistent information from the pages due to a caching problem in the API.
|
||||
// Comment from the Developer of the API
|
||||
// That would be caused from different pages getting cached at different times.
|
||||
// Since top rated only pulls TV shows with 2 or more votes right now this will be something that happens until we have a lot more ratings.
|
||||
// It's the single biggest missing data right now and there's no way around it until we get more people using the TV data.
|
||||
// And as we get more ratings I increase that limit so we get more accurate results.
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetTvShowTopRatedAsync(i));
|
||||
|
||||
SearchContainer<SearchTv> result = await TMDbClient.GetTvShowTopRatedAsync();
|
||||
Assert.NotNull(result.Results[0].Name);
|
||||
Assert.NotNull(result.Results[0].OriginalName);
|
||||
Assert.NotNull(result.Results[0].FirstAirDate);
|
||||
Assert.NotNull(result.Results[0].PosterPath);
|
||||
Assert.NotNull(result.Results[0].BackdropPath);
|
||||
Assert.NotNull(result.Results[0].PosterPath ?? result.Results[0].BackdropPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -443,14 +295,20 @@ namespace TMDbLibTests
|
||||
public async Task TestTvShowReviews()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync<SearchContainerWithId<ReviewBase>, ReviewBase>(i => TMDbClient.GetTvShowReviewsAsync(IdHelper.BreakingBad, page: i));
|
||||
|
||||
SearchContainerWithId<ReviewBase> reviews = await TMDbClient.GetTvShowReviewsAsync(IdHelper.BreakingBad);
|
||||
|
||||
ReviewBase single = reviews.Results.Single(s => s.Id == "5accdbe6c3a3687e2702d058");
|
||||
|
||||
await Verify(single);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestTvShowLists()
|
||||
public async Task TestTvShowLists()
|
||||
{
|
||||
foreach (TvShowListType type in Enum.GetValues(typeof(TvShowListType)).OfType<TvShowListType>())
|
||||
{
|
||||
TestHelpers.SearchPagesAsync(i => TMDbClient.GetTvShowListAsync(type, i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetTvShowListAsync(type, i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,160 +316,91 @@ namespace TMDbLibTests
|
||||
public async Task TestTvShowAccountStateFavoriteSet()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Remove the favourite
|
||||
if (accountState.Favorite)
|
||||
await TestMethodsHelper.SetValidateRemoveTest(async () =>
|
||||
{
|
||||
// Favourite the movie
|
||||
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
|
||||
}, async () =>
|
||||
{
|
||||
// Un-favorite the movie
|
||||
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false);
|
||||
}, async shouldBe =>
|
||||
{
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie is NOT favourited
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.False(accountState.Favorite);
|
||||
|
||||
// Favourite the movie
|
||||
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie IS favourited
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.True(accountState.Favorite);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.Equal(shouldBe, accountState.Favorite);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowAccountStateWatchlistSet()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Remove the watchlist
|
||||
if (accountState.Watchlist)
|
||||
await TestMethodsHelper.SetValidateRemoveTest(async () =>
|
||||
{
|
||||
// Add to watchlist
|
||||
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
|
||||
}, async () =>
|
||||
{
|
||||
// Remove from watchlist
|
||||
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false);
|
||||
}, async shouldBe =>
|
||||
{
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie is NOT watchlisted
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.False(accountState.Watchlist);
|
||||
|
||||
// Watchlist the movie
|
||||
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie IS watchlisted
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.True(accountState.Watchlist);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.Equal(shouldBe, accountState.Watchlist);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowAccountStateRatingSet()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Remove the rating
|
||||
if (accountState.Rating.HasValue)
|
||||
await TestMethodsHelper.SetValidateRemoveTest(async () =>
|
||||
{
|
||||
// Rate
|
||||
await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
}, async () =>
|
||||
{
|
||||
// Un-rate
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
}, async shouldBe =>
|
||||
{
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie is NOT rated
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.False(accountState.Rating.HasValue);
|
||||
|
||||
// Rate the movie
|
||||
await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the movie IS rated
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.True(accountState.Rating.HasValue);
|
||||
|
||||
// Remove the rating
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
if (shouldBe)
|
||||
{
|
||||
Assert.NotNull(accountState.Rating);
|
||||
Assert.Equal(5, accountState.Rating.Value);
|
||||
}
|
||||
else
|
||||
Assert.Null(accountState.Rating);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingBadRatingAsync()
|
||||
public async Task TestTvShowSetRating()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingRatingOutOfBounds()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 10.5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingRatingLowerBoundsTest()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.0));
|
||||
|
||||
Assert.False(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.1));
|
||||
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.5));
|
||||
|
||||
Assert.False(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingUserSession()
|
||||
{
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Remove the rating
|
||||
if (accountState.Rating.HasValue)
|
||||
{
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
|
||||
// Test that the episode is NOT rated
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.False(accountState.Rating.HasValue);
|
||||
|
||||
// Rate the episode
|
||||
await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Test that the episode IS rated
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.True(accountState.Rating.HasValue);
|
||||
|
||||
// Remove the rating
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingGuestSession()
|
||||
{
|
||||
@ -621,6 +410,8 @@ namespace TMDbLibTests
|
||||
// Try changing the rating
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.5));
|
||||
|
||||
Assert.False(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.1));
|
||||
|
||||
// Try changing it back to the previous rating
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 8));
|
||||
}
|
||||
|
@ -20,14 +20,18 @@
|
||||
|
||||
// TV
|
||||
public const int GameOfThrones = 1399;
|
||||
public const int GameOfThronesSeason8 = 107971;
|
||||
public const int GameOfThronesSeason4Episode10 = 63103;
|
||||
public const int BreakingBad = 1396;
|
||||
public const int BreakingBadSeason1Id = 3572;
|
||||
public const int BreakingBadSeason1Episode1Id = 62085;
|
||||
public const int BigBangTheory = 1418;
|
||||
public const int BigBangTheorySeason1Episode1Id = 64766;
|
||||
public const int BigBangTheorySeason1Episode2Id = 64777;
|
||||
public const int KeepingUpAppearances = 34;
|
||||
public const int DoctorWho = 121;
|
||||
public const int House = 1408;
|
||||
public const int FullerHouse = 63623;
|
||||
|
||||
public const int TmdbBreakingBadId = 1396;
|
||||
public const string TvdbBreakingBadId = "81189";
|
||||
@ -39,7 +43,7 @@
|
||||
public const string FreebaseMidBreakingBadId = "m/03d34x8";
|
||||
|
||||
// Persons
|
||||
public const int PersonPartialDate = 833;
|
||||
public const int FrankSinatra = 4347;
|
||||
public const int BruceWillis = 62;
|
||||
public const int HughLaurie = 41419;
|
||||
public const string ImdbBruceWillis = "nm0000246";
|
||||
@ -47,6 +51,7 @@
|
||||
|
||||
// Collections
|
||||
public const int JamesBondCollection = 645;
|
||||
public const int BackToTheFutureCollection = 264;
|
||||
|
||||
// Networks
|
||||
public const int TwentiethCenturyFox = 25;
|
||||
@ -58,6 +63,13 @@
|
||||
public const string BruceWillisMiamiVice = "525719bb760ee3776a1835d3";
|
||||
public const string HughLaurieHouse = "5256ccf519c2956ff607ca00";
|
||||
|
||||
// Genres
|
||||
public const int ActionAdventureTvGenre = 10759;
|
||||
public const int AdventureMovieGenre = 12;
|
||||
|
||||
// Keywords
|
||||
public const int AgentKeyword = 33705;
|
||||
|
||||
// Invalid IDs
|
||||
public const int MissingMovie = 230;
|
||||
public const int MissingID = 999999999;
|
||||
|
32
TMDbLibTests/Helpers/PropertyHelpers.cs
Normal file
32
TMDbLibTests/Helpers/PropertyHelpers.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
|
||||
namespace TMDbLibTests.Helpers
|
||||
{
|
||||
internal static class PropertyHelpers
|
||||
{
|
||||
public static PropertyInfo GetPropertyInfo<TSource, TProperty>(Expression<Func<TSource, TProperty>> propertyLambda)
|
||||
{
|
||||
Type type = typeof(TSource);
|
||||
|
||||
MemberExpression member;
|
||||
if (propertyLambda.Body is MemberExpression asMember)
|
||||
member = asMember;
|
||||
else if (propertyLambda.Body is UnaryExpression asUnary && asUnary.Operand is MemberExpression asMember2)
|
||||
member = asMember2;
|
||||
else
|
||||
throw new ArgumentException($"Expression '{propertyLambda}' refers to a method, not a property.");
|
||||
|
||||
PropertyInfo propInfo = member.Member as PropertyInfo;
|
||||
if (propInfo == null)
|
||||
throw new ArgumentException($"Expression '{propertyLambda}' refers to a field, not a property.");
|
||||
|
||||
if (type != propInfo.ReflectedType &&
|
||||
!type.IsSubclassOf(propInfo.ReflectedType))
|
||||
throw new ArgumentException($"Expression '{propertyLambda}' refers to a property that is not from type {type}.");
|
||||
|
||||
return propInfo;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using TMDbLib.Objects.General;
|
||||
using Xunit;
|
||||
@ -9,31 +7,6 @@ namespace TMDbLibTests.Helpers
|
||||
{
|
||||
public static class TestHelpers
|
||||
{
|
||||
[Obsolete("Use HttpClient")]
|
||||
public static async Task<bool> InternetUriExistsAsync(Uri uri)
|
||||
{
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
|
||||
req.Method = "HEAD";
|
||||
|
||||
try
|
||||
{
|
||||
using (await req.GetResponseAsync())
|
||||
{
|
||||
// It exists
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
HttpWebResponse response = (HttpWebResponse)ex.Response;
|
||||
if (response == null)
|
||||
Debug.WriteLine(ex.Status + ": " + uri);
|
||||
else
|
||||
Debug.WriteLine(response.StatusCode + ": " + uri);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Task SearchPagesAsync<T>(Func<int, Task<SearchContainer<T>>> getter)
|
||||
{
|
||||
return SearchPagesAsync<SearchContainer<T>, T>(getter);
|
||||
@ -43,24 +16,19 @@ namespace TMDbLibTests.Helpers
|
||||
{
|
||||
// Check page 1
|
||||
TContainer results = await getter(1);
|
||||
|
||||
Assert.NotNull(results);
|
||||
Assert.NotNull(results.Results);
|
||||
|
||||
Assert.Equal(1, results.Page);
|
||||
Assert.NotEmpty(results.Results);
|
||||
Assert.True(results.Results.Count > 0);
|
||||
Assert.True(results.TotalResults > 0);
|
||||
Assert.True(results.TotalPages > 0);
|
||||
|
||||
// Check page 2
|
||||
TContainer results2 = await getter(2);
|
||||
|
||||
Assert.NotNull(results2);
|
||||
Assert.NotNull(results2.Results);
|
||||
|
||||
Assert.Equal(2, results2.Page);
|
||||
// The page counts often don't match due to caching on the api
|
||||
//Assert.AreEqual(results.TotalResults, results2.TotalResults);
|
||||
//Assert.AreEqual(results.TotalPages, results2.TotalPages);
|
||||
|
||||
// If page 1 has all results, page 2 must be empty - else not.
|
||||
if (results.Results.Count == results.TotalResults)
|
||||
Assert.Empty(results2.Results);
|
||||
else
|
||||
|
@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TMDbLib.Objects.General;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using TMDbLib.Objects.General;
|
||||
using TMDbLib.Objects.People;
|
||||
using Xunit;
|
||||
|
||||
@ -13,43 +10,25 @@ namespace TMDbLibTests.Helpers
|
||||
{
|
||||
private static readonly Regex ImagePathRegex = new Regex(@"^/[a-zA-Z0-9]{26,}\.(?:jpg|png)$", RegexOptions.Compiled);
|
||||
|
||||
public static async Task TestImagesAsync(TestConfig config, ProfileImages images)
|
||||
public static void TestImagePaths(Images images)
|
||||
{
|
||||
Assert.True(images.Profiles.Count > 0);
|
||||
|
||||
string profileSize = config.Client.Config.Images.ProfileSizes.First();
|
||||
|
||||
await TestImagesInternal(config, images.Profiles.Select(s => s.FilePath), profileSize);
|
||||
TestImagePaths(images.Backdrops);
|
||||
TestImagePaths(images.Posters);
|
||||
}
|
||||
|
||||
public static async Task TestImagesAsync(TestConfig config, Images images)
|
||||
public static void TestImagePaths(IEnumerable<string> imagePaths)
|
||||
{
|
||||
Assert.True(images.Backdrops.Count > 0);
|
||||
Assert.True(images.Posters.Count > 0);
|
||||
|
||||
string backdropSize = config.Client.Config.Images.BackdropSizes.First();
|
||||
string posterSize = config.Client.Config.Images.PosterSizes.First();
|
||||
|
||||
await TestImagesInternal(config, images.Backdrops.Select(s => s.FilePath), backdropSize);
|
||||
|
||||
await TestImagesInternal(config, images.Posters.Select(s => s.FilePath), posterSize);
|
||||
Assert.All(imagePaths, path => Assert.True(ImagePathRegex.IsMatch(path), "path was not a valid image path, was: " + path));
|
||||
}
|
||||
|
||||
private static async Task TestImagesInternal(TestConfig config, IEnumerable<string> images, string posterSize)
|
||||
public static void TestImagePaths<T>(IEnumerable<T> images) where T : ImageData
|
||||
{
|
||||
foreach (string imageData in images)
|
||||
{
|
||||
Uri url = config.Client.GetImageUrl(posterSize, imageData);
|
||||
Uri urlSecure = config.Client.GetImageUrl(posterSize, imageData, true);
|
||||
|
||||
Assert.True(await TestHelpers.InternetUriExistsAsync(url));
|
||||
Assert.True(await TestHelpers.InternetUriExistsAsync(urlSecure));
|
||||
}
|
||||
Assert.All(images, x => Assert.True(ImagePathRegex.IsMatch(x.FilePath), "image.FilePath was not a valid image path, was: " + x.FilePath));
|
||||
}
|
||||
|
||||
public static bool TestImagePath(string path)
|
||||
public static void TestImagePaths(IEnumerable<TaggedImage> images)
|
||||
{
|
||||
return ImagePathRegex.IsMatch(path);
|
||||
Assert.All(images, x => Assert.True(ImagePathRegex.IsMatch(x.FilePath), "image.FilePath was not a valid image path, was: " + x.FilePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace TMDbLibTests.Helpers
|
||||
/// <summary>
|
||||
/// Tests that a client method will get all parts of the TMDb api, when requested
|
||||
/// </summary>
|
||||
public static async Task TestGetAll<TEnum, TResult>(Dictionary<TEnum, Func<TResult, object>> methodSelectors, Func<TEnum, Task<TResult>> getterMethod, Action<TResult> extraAction = null) where TEnum : Enum
|
||||
public static async Task TestGetAll<TEnum, TResult>(Dictionary<TEnum, Func<TResult, object>> methodSelectors, Func<TEnum, Task<TResult>> getterMethod, Func<TResult, Task> extraAction = null) where TEnum : Enum
|
||||
{
|
||||
int combinedEnumInt = 0;
|
||||
foreach (TEnum key in methodSelectors.Keys)
|
||||
@ -46,7 +46,29 @@ namespace TMDbLibTests.Helpers
|
||||
Assert.NotNull(methodSelectors[method](item));
|
||||
|
||||
// Execute any additional tests
|
||||
extraAction?.Invoke(item);
|
||||
if (extraAction != null)
|
||||
await extraAction(item);
|
||||
}
|
||||
|
||||
public static async Task SetValidateRemoveTest(Func<Task> set, Func<Task> remove, Func<bool, Task> validate)
|
||||
{
|
||||
// Act
|
||||
await set();
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Validate
|
||||
await validate(true);
|
||||
|
||||
// Act
|
||||
await remove();
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
await Task.Delay(2000);
|
||||
|
||||
// Validate
|
||||
await validate(false);
|
||||
}
|
||||
}
|
||||
}
|
73
TMDbLibTests/Helpers/VerifyExtensions.cs
Normal file
73
TMDbLibTests/Helpers/VerifyExtensions.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
using VerifyTests;
|
||||
|
||||
namespace TMDbLibTests.Helpers
|
||||
{
|
||||
internal static class VerifyExtensions
|
||||
{
|
||||
private static string GetPropertyName<T>(Expression<Func<T, object>> expression)
|
||||
{
|
||||
PropertyInfo prop = PropertyHelpers.GetPropertyInfo(expression);
|
||||
|
||||
JsonPropertyAttribute jsonPropAttribute = prop.GetCustomAttribute<JsonPropertyAttribute>();
|
||||
return jsonPropAttribute?.PropertyName ?? prop.Name;
|
||||
}
|
||||
|
||||
public static VerifySettings IgnoreProperty(this VerifySettings settings, params string[] properties)
|
||||
{
|
||||
foreach (string propName in properties)
|
||||
{
|
||||
string searchString = $" {propName}: ";
|
||||
settings.ScrubLines(x => x.Contains(searchString));
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
public static VerifySettings IgnoreProperty<T>(this VerifySettings settings, params Expression<Func<T, object>>[] properties)
|
||||
{
|
||||
string[] propNames = properties.Select(GetPropertyName).ToArray();
|
||||
|
||||
return settings.IgnoreProperty(propNames);
|
||||
}
|
||||
|
||||
private static Regex _propRegex = new Regex(@"^(?<pre>[\s]*)(?<name>[\S]+): (?<value>.*?)(?<post>,|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public static VerifySettings SimplifyProperty(this VerifySettings settings, params string[] properties)
|
||||
{
|
||||
foreach (string propName in properties)
|
||||
{
|
||||
settings.ScrubLinesWithReplace(original =>
|
||||
{
|
||||
Match match = _propRegex.Match(original);
|
||||
if (!match.Success)
|
||||
return original;
|
||||
|
||||
if (match.Groups["name"].Value != propName)
|
||||
return original;
|
||||
|
||||
string newValue = match.Groups["value"].Value;
|
||||
if (newValue.Length > 0)
|
||||
newValue = "<non-empty>";
|
||||
|
||||
return match.Groups["pre"].Value + match.Groups["name"].Value + ": " + newValue +
|
||||
match.Groups["post"].Value;
|
||||
});
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
public static VerifySettings SimplifyProperty<T>(this VerifySettings settings, params Expression<Func<T, object>>[] properties)
|
||||
{
|
||||
string[] propNames = properties.Select(GetPropertyName).ToArray();
|
||||
|
||||
return settings.SimplifyProperty(propNames);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,175 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using TMDbLib.Client;
|
||||
using TMDbLib.Objects.General;
|
||||
using TMDbLib.Objects.Search;
|
||||
using TMDbLibTests.Helpers;
|
||||
using VerifyTests;
|
||||
using VerifyXunit;
|
||||
|
||||
namespace TMDbLibTests.JsonHelpers
|
||||
{
|
||||
[UsesVerify]
|
||||
public abstract class TestBase
|
||||
{
|
||||
private VerifySettings VerifySettings { get; }
|
||||
|
||||
protected readonly TestConfig TestConfig;
|
||||
|
||||
protected TMDbClient TMDbClient => TestConfig.Client;
|
||||
|
||||
protected TestBase()
|
||||
{
|
||||
VerifySettings = new VerifySettings();
|
||||
//VerifySettings.UseExtension("json");
|
||||
VerifySettings.AutoVerify();
|
||||
|
||||
VerifySettings.UseDirectory("..\\Verification");
|
||||
|
||||
// Ignore and simplify many dynamic properties
|
||||
VerifySettings.IgnoreProperty<SearchMovie>(x => x.VoteCount, x => x.Popularity, x => x.VoteAverage);
|
||||
VerifySettings.SimplifyProperty<SearchMovie>(x => x.BackdropPath, x => x.PosterPath);
|
||||
VerifySettings.SimplifyProperty<SearchPerson>(x => x.ProfilePath);
|
||||
VerifySettings.SimplifyProperty<SearchTvEpisode>(x => x.StillPath);
|
||||
VerifySettings.SimplifyProperty<ImageData>(x => x.FilePath);
|
||||
VerifySettings.SimplifyProperty<SearchCompany>(x => x.LogoPath);
|
||||
|
||||
VerifySettings.AddExtraSettings(serializerSettings =>
|
||||
{
|
||||
serializerSettings.ContractResolver = new DataSortingContractResolver(serializerSettings.ContractResolver);
|
||||
});
|
||||
|
||||
JsonSerializerSettings sett = new JsonSerializerSettings();
|
||||
|
||||
TestConfig = new TestConfig(serializer: JsonSerializer.Create(sett));
|
||||
WebProxy proxy = null;
|
||||
//WebProxy proxy = new WebProxy("http://127.0.0.1:8888");
|
||||
|
||||
TestConfig = new TestConfig(serializer: JsonSerializer.Create(sett), proxy: proxy);
|
||||
}
|
||||
|
||||
protected Task Verify<T>(T obj, Action<VerifySettings> configure = null)
|
||||
{
|
||||
VerifySettings settings = VerifySettings;
|
||||
|
||||
if (configure != null)
|
||||
{
|
||||
settings = new VerifySettings(VerifySettings);
|
||||
configure(settings);
|
||||
}
|
||||
|
||||
return Verifier.Verify(obj, settings);
|
||||
}
|
||||
|
||||
class DataSortingContractResolver : IContractResolver
|
||||
{
|
||||
private readonly IContractResolver _innerResolver;
|
||||
|
||||
public DataSortingContractResolver(IContractResolver innerResolver)
|
||||
{
|
||||
_innerResolver = innerResolver;
|
||||
}
|
||||
|
||||
public JsonContract ResolveContract(Type type)
|
||||
{
|
||||
JsonContract contract = _innerResolver.ResolveContract(type);
|
||||
|
||||
// Add a callback that is invoked on each serialization of an object
|
||||
// We do this to be able to sort lists
|
||||
contract.OnSerializingCallbacks.Add(SerializingCallback);
|
||||
|
||||
return contract;
|
||||
}
|
||||
|
||||
private static string[] _sortFieldsInOrder = { "CreditId", "Id", "Iso_3166_1", "EpisodeNumber", "SeasonNumber" };
|
||||
|
||||
private void SerializingCallback(object obj, StreamingContext context)
|
||||
{
|
||||
if (!(obj is IEnumerable) || obj is IDictionary)
|
||||
return;
|
||||
|
||||
Type objType = obj.GetType();
|
||||
if (obj is IList objAsList)
|
||||
{
|
||||
Debug.Assert(objType.IsGenericType);
|
||||
|
||||
Type innerType = objType.GetGenericArguments().First();
|
||||
|
||||
// Determine which comparer to use
|
||||
IComparer comparer = null;
|
||||
if (innerType.IsValueType)
|
||||
comparer = Comparer.Default;
|
||||
else
|
||||
{
|
||||
foreach (string fieldName in _sortFieldsInOrder)
|
||||
{
|
||||
PropertyInfo prop = innerType.GetProperty(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty);
|
||||
if (prop == null)
|
||||
continue;
|
||||
|
||||
comparer = new CompareObjectOnProperty(prop);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (comparer != null)
|
||||
{
|
||||
// Is sorted?
|
||||
bool isSorted = IsSorted(objAsList, comparer);
|
||||
|
||||
if (!isSorted)
|
||||
{
|
||||
// Sort the list using our comparer
|
||||
List<object> sortList = objAsList.Cast<object>().ToList();
|
||||
sortList.Sort((x, y) => comparer.Compare(x, y));
|
||||
|
||||
// Transfer values
|
||||
for (int i = 0; i < objAsList.Count; i++)
|
||||
objAsList[i] = sortList[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsSorted(IList list, IComparer comparer)
|
||||
{
|
||||
for (var i = 1; i < list.Count; i++)
|
||||
{
|
||||
var a = list[i - 1];
|
||||
var b = list[i];
|
||||
|
||||
if (comparer.Compare(a, b) > 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
class CompareObjectOnProperty : IComparer
|
||||
{
|
||||
private readonly PropertyInfo _property;
|
||||
|
||||
public CompareObjectOnProperty(PropertyInfo property)
|
||||
{
|
||||
_property = property;
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
object? valX = _property.GetValue(x);
|
||||
object? valY = _property.GetValue(y);
|
||||
|
||||
return Comparer.Default.Compare(valX, valY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,10 @@
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="JsonHelpers\*.verified.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TMDbLib\TMDbLib.csproj" />
|
||||
</ItemGroup>
|
||||
@ -14,6 +18,7 @@
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" PrivateAssets="All" />
|
||||
<PackageReference Include="Verify.Xunit" Version="11.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using TMDbLibTests.Exceptions;
|
||||
using TMDbLib.Client;
|
||||
|
||||
@ -13,18 +14,18 @@ namespace TMDbLibTests
|
||||
public readonly string UserSessionId = "c413282cdadad9af972c06d9b13096a8b13ab1c1";
|
||||
public readonly string GuestTestSessionId = "d425468da2781d6799ba14c05f7327e7";
|
||||
|
||||
public TMDbClient Client { get; set; }
|
||||
public TMDbClient Client { get; }
|
||||
|
||||
public string Username = "TMDbTestAccount";
|
||||
|
||||
public string Password = "TJX6vP7bPC%!ZrJwAqtCU5FshHEKAwzr6YvR3%CU9s7BrjqUWmjC8AMuXju*eTEu524zsxDQK5ySY6EmjAC3e54B%WvkS9FNPE3K";
|
||||
|
||||
public TestConfig(bool useSsl = false, JsonSerializer serializer = null)
|
||||
public TestConfig(bool useSsl = false, JsonSerializer serializer = null, IWebProxy proxy = null)
|
||||
{
|
||||
if (APIKey.Length == 0)
|
||||
throw new ConfigurationErrorsException("You need to configure the API Key before running any tests. Look at the TestConfig class.");
|
||||
|
||||
Client = new TMDbClient(APIKey, useSsl, serializer: serializer)
|
||||
Client = new TMDbClient(APIKey, useSsl, serializer: serializer, proxy: proxy)
|
||||
{
|
||||
MaxRetryCount = 1
|
||||
};
|
||||
|
@ -21,13 +21,15 @@ namespace TMDbLibTests.UtilityTests
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.Converters.Add(new AccountStateConverter());
|
||||
|
||||
AccountState original = new AccountState();
|
||||
original.Rating = 5;
|
||||
var original = new
|
||||
{
|
||||
rated = new { value = 5 }
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
AccountState result = JsonConvert.DeserializeObject<AccountState>(json, settings);
|
||||
|
||||
Assert.Equal(original.Rating, result.Rating);
|
||||
Assert.Equal(5, result.Rating);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -38,13 +40,11 @@ namespace TMDbLibTests.UtilityTests
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.Converters.Add(new AccountStateConverter());
|
||||
|
||||
AccountState original = new AccountState();
|
||||
original.Rating = null;
|
||||
|
||||
var original = new { rated = false };
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
AccountState result = JsonConvert.DeserializeObject<AccountState>(json, settings);
|
||||
|
||||
Assert.Equal(original.Rating, result.Rating);
|
||||
Assert.Null(result.Rating);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -56,10 +56,7 @@ namespace TMDbLibTests.UtilityTests
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar);
|
||||
|
||||
Assert.Equal(IdHelper.Avatar, accountState.Id);
|
||||
Assert.True(accountState.Favorite);
|
||||
Assert.False(accountState.Watchlist);
|
||||
Assert.Equal(2.5d, accountState.Rating);
|
||||
await Verify(accountState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -72,20 +69,19 @@ namespace TMDbLibTests.UtilityTests
|
||||
ResultContainer<TvEpisodeAccountStateWithNumber> season = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BigBangTheory, 1);
|
||||
|
||||
// Episode 1 has a rating
|
||||
TvEpisodeAccountStateWithNumber episode = season.Results.FirstOrDefault(s => s.EpisodeNumber == 1);
|
||||
Assert.NotNull(episode);
|
||||
TvEpisodeAccountStateWithNumber episodeA = season.Results.Single(s => s.EpisodeNumber == 1);
|
||||
|
||||
Assert.Equal(IdHelper.BigBangTheorySeason1Episode1Id, episode.Id);
|
||||
Assert.Equal(1, episode.EpisodeNumber);
|
||||
Assert.Equal(5d, episode.Rating);
|
||||
Assert.NotNull(episodeA.Rating);
|
||||
|
||||
// Episode 2 has no rating
|
||||
episode = season.Results.FirstOrDefault(s => s.EpisodeNumber == 2);
|
||||
Assert.NotNull(episode);
|
||||
TvEpisodeAccountStateWithNumber episodeB = season.Results.Single(s => s.EpisodeNumber == 2);
|
||||
Assert.Null(episodeB.Rating);
|
||||
|
||||
Assert.Equal(IdHelper.BigBangTheorySeason1Episode2Id, episode.Id);
|
||||
Assert.Equal(2, episode.EpisodeNumber);
|
||||
Assert.Null(episode.Rating);
|
||||
await Verify(new
|
||||
{
|
||||
episodeA,
|
||||
episodeB
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ namespace TMDbLibTests.UtilityTests
|
||||
public class ChangeItemConverterTest : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ChangeItemConverter_ChangeItemAdded()
|
||||
public async Task ChangeItemConverter_ChangeItemAdded()
|
||||
{
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.Converters.Add(new ChangeItemConverter());
|
||||
@ -25,13 +25,11 @@ namespace TMDbLibTests.UtilityTests
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
ChangeItemAdded result = JsonConvert.DeserializeObject<ChangeItemBase>(json, settings) as ChangeItemAdded;
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(original.Iso_639_1, result.Iso_639_1);
|
||||
Assert.Equal(original.Value, result.Value);
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChangeItemConverter_ChangeItemCreated()
|
||||
public async Task ChangeItemConverter_ChangeItemCreated()
|
||||
{
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.Converters.Add(new ChangeItemConverter());
|
||||
@ -41,13 +39,12 @@ namespace TMDbLibTests.UtilityTests
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
ChangeItemCreated result = JsonConvert.DeserializeObject<ChangeItemBase>(json, settings) as ChangeItemCreated;
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(original.Iso_639_1, result.Iso_639_1);
|
||||
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChangeItemConverter_ChangeItemDeleted()
|
||||
public async Task ChangeItemConverter_ChangeItemDeleted()
|
||||
{
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.Converters.Add(new ChangeItemConverter());
|
||||
@ -58,14 +55,12 @@ namespace TMDbLibTests.UtilityTests
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
ChangeItemDeleted result = JsonConvert.DeserializeObject<ChangeItemBase>(json, settings) as ChangeItemDeleted;
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(original.Iso_639_1, result.Iso_639_1);
|
||||
Assert.Equal(original.OriginalValue, result.OriginalValue);
|
||||
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChangeItemConverter_ChangeItemUpdated()
|
||||
public async Task ChangeItemConverter_ChangeItemUpdated()
|
||||
{
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.Converters.Add(new ChangeItemConverter());
|
||||
@ -77,11 +72,8 @@ namespace TMDbLibTests.UtilityTests
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
ChangeItemUpdated result = JsonConvert.DeserializeObject<ChangeItemBase>(json, settings) as ChangeItemUpdated;
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(original.Iso_639_1, result.Iso_639_1);
|
||||
Assert.Equal(original.OriginalValue, result.OriginalValue);
|
||||
Assert.Equal(original.Value, result.Value);
|
||||
|
||||
await Verify(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -91,7 +83,8 @@ namespace TMDbLibTests.UtilityTests
|
||||
public async Task TestChangeItemConverter()
|
||||
{
|
||||
Movie latestMovie = await TMDbClient.GetMovieLatestAsync();
|
||||
List<Change> changes = await TMDbClient.GetMovieChangesAsync(latestMovie.Id);
|
||||
IList<Change> changes = await TMDbClient.GetMovieChangesAsync(latestMovie.Id);
|
||||
|
||||
List<ChangeItemBase> changeItems = changes.SelectMany(s => s.Items).ToList();
|
||||
|
||||
ChangeAction[] actions = { ChangeAction.Added, ChangeAction.Created, ChangeAction.Updated };
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
using TMDbLib.Objects.Changes;
|
||||
using TMDbLib.Objects.General;
|
||||
@ -15,11 +13,11 @@ namespace TMDbLibTests.UtilityTests
|
||||
{
|
||||
public static IEnumerable<object[]> GetEnumMembers(Type type)
|
||||
{
|
||||
IEnumerable<FieldInfo> members = type.GetTypeInfo().DeclaredFields.Where(s => s.IsStatic);
|
||||
Array values = Enum.GetValues(type);
|
||||
|
||||
foreach (FieldInfo member in members)
|
||||
foreach (Enum value in values)
|
||||
{
|
||||
yield return new[] { member.GetValue(null) };
|
||||
yield return new object[] { value };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace TMDbLibTests.UtilityTests
|
||||
public class KnownForConverterTest : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void KnownForConverter_Movie()
|
||||
public async Task KnownForConverter_Movie()
|
||||
{
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||
settings.Converters.Add(new KnownForConverter());
|
||||
@ -22,10 +22,9 @@ namespace TMDbLibTests.UtilityTests
|
||||
original.OriginalTitle = "Hello world";
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
KnownForMovie result = JsonConvert.DeserializeObject<KnownForBase>(json, settings) as KnownForMovie;
|
||||
KnownForMovie result = (KnownForMovie)JsonConvert.DeserializeObject<KnownForBase>(json, settings);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(original.MediaType, result.MediaType);
|
||||
Assert.Equal(original.Title, result.Title);
|
||||
}
|
||||
|
||||
@ -39,10 +38,9 @@ namespace TMDbLibTests.UtilityTests
|
||||
original.OriginalName = "Hello world";
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
KnownForTv result = JsonConvert.DeserializeObject<KnownForBase>(json, settings) as KnownForTv;
|
||||
KnownForTv result = (KnownForTv)JsonConvert.DeserializeObject<KnownForBase>(json, settings);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(original.MediaType, result.MediaType);
|
||||
Assert.Equal(original.OriginalName, result.OriginalName);
|
||||
}
|
||||
|
||||
@ -54,8 +52,7 @@ namespace TMDbLibTests.UtilityTests
|
||||
{
|
||||
SearchContainer<SearchPerson> result = await TMDbClient.SearchPersonAsync("Willis");
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
Assert.NotNull(result?.Results);
|
||||
|
||||
List<KnownForBase> knownForList = result.Results.SelectMany(s => s.KnownFor).ToList();
|
||||
Assert.True(knownForList.Any());
|
||||
|
@ -21,10 +21,9 @@ namespace TMDbLibTests.UtilityTests
|
||||
original.OriginalTitle = "Hello world";
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
SearchMovie result = JsonConvert.DeserializeObject<SearchBase>(json, settings) as SearchMovie;
|
||||
SearchMovie result = (SearchMovie)JsonConvert.DeserializeObject<SearchBase>(json, settings);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(original.MediaType, result.MediaType);
|
||||
Assert.Equal(original.OriginalTitle, result.OriginalTitle);
|
||||
}
|
||||
|
||||
@ -38,7 +37,7 @@ namespace TMDbLibTests.UtilityTests
|
||||
original.OriginalName = "Hello world";
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
SearchTv result = JsonConvert.DeserializeObject<SearchBase>(json, settings) as SearchTv;
|
||||
SearchTv result = (SearchTv)JsonConvert.DeserializeObject<SearchBase>(json, settings);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(original.MediaType, result.MediaType);
|
||||
@ -55,7 +54,7 @@ namespace TMDbLibTests.UtilityTests
|
||||
original.Name = "Hello world";
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
SearchPerson result = JsonConvert.DeserializeObject<SearchBase>(json, settings) as SearchPerson;
|
||||
SearchPerson result = (SearchPerson)JsonConvert.DeserializeObject<SearchBase>(json, settings);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(original.MediaType, result.MediaType);
|
||||
|
@ -20,9 +20,11 @@ namespace TMDbLibTests.UtilityTests
|
||||
|
||||
SearchMovie originalMedia = new SearchMovie { OriginalTitle = "Hello world" };
|
||||
|
||||
TaggedImage original = new TaggedImage();
|
||||
original.MediaType = MediaType.Movie;
|
||||
original.Media = originalMedia;
|
||||
TaggedImage original = new TaggedImage
|
||||
{
|
||||
MediaType = originalMedia.MediaType,
|
||||
Media = originalMedia
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(original, settings);
|
||||
TaggedImage result = JsonConvert.DeserializeObject<TaggedImage>(json, settings);
|
||||
@ -75,8 +77,16 @@ namespace TMDbLibTests.UtilityTests
|
||||
Assert.NotNull(result.Results);
|
||||
Assert.Equal(IdHelper.HughLaurie, result.Id);
|
||||
|
||||
Assert.Contains(result.Results, item => item.MediaType == MediaType.Tv && item.Media is SearchTv);
|
||||
Assert.Contains(result.Results, item => item.MediaType == MediaType.Movie && item.Media is SearchMovie);
|
||||
Assert.All(result.Results, item =>
|
||||
{
|
||||
if (item.MediaType == MediaType.Tv)
|
||||
Assert.IsType<SearchTv>(item.Media);
|
||||
});
|
||||
Assert.All(result.Results, item =>
|
||||
{
|
||||
if (item.MediaType == MediaType.Movie)
|
||||
Assert.IsType<SearchMovie>(item.Media);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -11,16 +11,16 @@ namespace TMDbLibTests.UtilityTests
|
||||
[Fact]
|
||||
public void EnumDescriptionNonEnumTest()
|
||||
{
|
||||
EnumTestStruct strct = new EnumTestStruct();
|
||||
EnumTestStruct @struct = new EnumTestStruct();
|
||||
|
||||
Assert.Throws<ArgumentException>(() => strct.GetDescription());
|
||||
Assert.Throws<ArgumentException>(() => @struct.GetDescription());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnumDescriptionNonDescriptionTest()
|
||||
{
|
||||
EnumTestEnum enm = EnumTestEnum.A;
|
||||
string s = enm.GetDescription();
|
||||
EnumTestEnum @enum = EnumTestEnum.A;
|
||||
string s = @enum.GetDescription();
|
||||
|
||||
Assert.Equal("A", s);
|
||||
}
|
||||
@ -28,8 +28,8 @@ namespace TMDbLibTests.UtilityTests
|
||||
[Fact]
|
||||
public void EnumDescriptionTest()
|
||||
{
|
||||
EnumTestEnum enm = EnumTestEnum.B;
|
||||
string s = enm.GetDescription();
|
||||
EnumTestEnum @enum = EnumTestEnum.B;
|
||||
string s = @enum.GetDescription();
|
||||
|
||||
Assert.Equal("B-Description", s);
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
favorite: true,
|
||||
id: 19995
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
episodeA: {
|
||||
episode_number: 1,
|
||||
id: 64766,
|
||||
rating: 5.0
|
||||
},
|
||||
episodeB: {
|
||||
episode_number: 2,
|
||||
id: 64777
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
value: Hello world,
|
||||
action: added,
|
||||
iso_639_1: en
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
action: created,
|
||||
iso_639_1: en
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
original_value: Hello world,
|
||||
action: deleted,
|
||||
iso_639_1: en
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
original_value: Hello world,
|
||||
value: Hello world 1234,
|
||||
action: updated,
|
||||
iso_639_1: en
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
list_type: movie,
|
||||
description: This is a test list,
|
||||
id: 1724,
|
||||
iso_639_1: en,
|
||||
item_count: 1,
|
||||
name: Test list
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
avatar: {
|
||||
gravatar: {
|
||||
hash: Guid_1
|
||||
}
|
||||
},
|
||||
id: 6089455,
|
||||
iso_3166_1: BE,
|
||||
iso_639_1: en,
|
||||
name: Test Name,
|
||||
username: TMDbTestAccount
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
original_title: Avatar,
|
||||
release_date: DateTime_1,
|
||||
title: Avatar,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
12,
|
||||
14,
|
||||
28,
|
||||
878
|
||||
],
|
||||
original_language: en,
|
||||
overview: In the 22nd century, a paraplegic Marine is dispatched to the moon Pandora on a unique mission, but becomes torn between following orders and protecting an alien civilization.,
|
||||
poster_path: <non-empty>,
|
||||
id: 19995,
|
||||
media_type: movie,
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
original_title: Dumb and Dumber To,
|
||||
release_date: DateTime_1,
|
||||
title: Dumb and Dumber To,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
35
|
||||
],
|
||||
original_language: en,
|
||||
overview: 20 years since their first adventure, Lloyd and Harry go on a road trip to find Harry's newly discovered daughter, who was given up for adoption.,
|
||||
poster_path: <non-empty>,
|
||||
id: 100042,
|
||||
media_type: movie,
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
original_title: Avatar,
|
||||
release_date: DateTime_1,
|
||||
title: Avatar,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
12,
|
||||
14,
|
||||
28,
|
||||
878
|
||||
],
|
||||
original_language: en,
|
||||
overview: In the 22nd century, a paraplegic Marine is dispatched to the moon Pandora on a unique mission, but becomes torn between following orders and protecting an alien civilization.,
|
||||
poster_path: <non-empty>,
|
||||
id: 19995,
|
||||
media_type: movie,
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
rating: 5.0,
|
||||
first_air_date: DateTime_1,
|
||||
name: The Big Bang Theory,
|
||||
original_name: The Big Bang Theory,
|
||||
origin_country: [
|
||||
US
|
||||
],
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
35
|
||||
],
|
||||
original_language: en,
|
||||
overview: The sitcom is centered on five characters living in Pasadena, California: roommates Leonard Hofstadter and Sheldon Cooper; Penny, a waitress and aspiring actress who lives across the hall; and Leonard and Sheldon's equally geeky and socially awkward friends and co-workers, mechanical engineer Howard Wolowitz and astrophysicist Raj Koothrappali. The geekiness and intellect of the four guys is contrasted for comic effect with Penny's social skills and common sense.,
|
||||
poster_path: <non-empty>,
|
||||
id: 1418,
|
||||
media_type: tv,
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
first_air_date: DateTime_1,
|
||||
name: Two and a Half Men,
|
||||
original_name: Two and a Half Men,
|
||||
origin_country: [
|
||||
US
|
||||
],
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
35
|
||||
],
|
||||
original_language: en,
|
||||
overview: A hedonistic jingle writer's free-wheeling life comes to an abrupt halt when his brother and 10-year-old nephew move into his beach-front house.,
|
||||
poster_path: <non-empty>,
|
||||
id: 2691,
|
||||
media_type: tv,
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
Certification: E,
|
||||
Meaning: Exempt from classification. Films that are exempt from classification must not contain contentious material (i.e. material that would ordinarily be rated M or higher).,
|
||||
Order: 1
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
Certification: NR,
|
||||
Meaning: No rating information.
|
||||
}
|
@ -0,0 +1,663 @@
|
||||
{
|
||||
backdrop_path: <non-empty>,
|
||||
id: 264,
|
||||
images: {
|
||||
backdrops: [
|
||||
{
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 1080,
|
||||
width: 1920
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 1080,
|
||||
width: 1920
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 1080,
|
||||
width: 1920
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 1080,
|
||||
iso_639_1: en,
|
||||
width: 1920
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.778645833333333,
|
||||
file_path: <non-empty>,
|
||||
height: 768,
|
||||
iso_639_1: en,
|
||||
width: 1366
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 720,
|
||||
iso_639_1: en,
|
||||
width: 1280
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 1080,
|
||||
iso_639_1: en,
|
||||
width: 1920
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 1080,
|
||||
width: 1920
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.778645833333333,
|
||||
file_path: <non-empty>,
|
||||
height: 768,
|
||||
iso_639_1: en,
|
||||
width: 1366
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 1080,
|
||||
iso_639_1: de,
|
||||
width: 1920
|
||||
},
|
||||
{
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 1080,
|
||||
iso_639_1: ru,
|
||||
width: 1920
|
||||
}
|
||||
],
|
||||
posters: [
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: fr,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6661991584852734,
|
||||
file_path: <non-empty>,
|
||||
height: 1426,
|
||||
iso_639_1: ru,
|
||||
width: 950
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: de,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: it,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.7242120343839542,
|
||||
file_path: <non-empty>,
|
||||
height: 1396,
|
||||
iso_639_1: hu,
|
||||
width: 1011
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 750,
|
||||
iso_639_1: sv,
|
||||
width: 500
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: it,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: it,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 3000,
|
||||
iso_639_1: de,
|
||||
width: 2000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1800,
|
||||
iso_639_1: en,
|
||||
width: 1200
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: it,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 2100,
|
||||
iso_639_1: de,
|
||||
width: 1400
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: de,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 3000,
|
||||
iso_639_1: ru,
|
||||
width: 2000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: es,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.703771849126035,
|
||||
file_path: <non-empty>,
|
||||
height: 1087,
|
||||
iso_639_1: it,
|
||||
width: 765
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.7012622720897616,
|
||||
file_path: <non-empty>,
|
||||
height: 1426,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 750,
|
||||
iso_639_1: fr,
|
||||
width: 500
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.667,
|
||||
file_path: <non-empty>,
|
||||
height: 2000,
|
||||
iso_639_1: en,
|
||||
width: 1334
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.7013333333333334,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: de,
|
||||
width: 1052
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: de,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: fr,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6976744186046512,
|
||||
file_path: <non-empty>,
|
||||
height: 860,
|
||||
iso_639_1: es,
|
||||
width: 600
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.7090909090909091,
|
||||
file_path: <non-empty>,
|
||||
height: 1100,
|
||||
iso_639_1: en,
|
||||
width: 780
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.7459165154264973,
|
||||
file_path: <non-empty>,
|
||||
height: 1102,
|
||||
iso_639_1: fr,
|
||||
width: 822
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6871794871794872,
|
||||
file_path: <non-empty>,
|
||||
height: 975,
|
||||
iso_639_1: en,
|
||||
width: 670
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 3000,
|
||||
iso_639_1: en,
|
||||
width: 2000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: fr,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: fr,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: fr,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.700770847932726,
|
||||
file_path: <non-empty>,
|
||||
height: 2854,
|
||||
iso_639_1: de,
|
||||
width: 2000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 900,
|
||||
iso_639_1: sv,
|
||||
width: 600
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: de,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: de,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: de,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: ru,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: ru,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: ru,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: sk,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: de,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: sk,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: en,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: hu,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 3000,
|
||||
iso_639_1: it,
|
||||
width: 2000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.7012622720897616,
|
||||
file_path: <non-empty>,
|
||||
height: 1426,
|
||||
iso_639_1: it,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.7012622720897616,
|
||||
file_path: <non-empty>,
|
||||
height: 1426,
|
||||
iso_639_1: it,
|
||||
width: 1000
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.7269372693726938,
|
||||
file_path: <non-empty>,
|
||||
height: 813,
|
||||
iso_639_1: uk,
|
||||
width: 591
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6931407942238267,
|
||||
file_path: <non-empty>,
|
||||
height: 2216,
|
||||
iso_639_1: de,
|
||||
width: 1536
|
||||
},
|
||||
{
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 1500,
|
||||
iso_639_1: pt,
|
||||
width: 1000
|
||||
}
|
||||
]
|
||||
},
|
||||
name: Back to the Future Collection,
|
||||
overview: An American science fiction–comedy film series that follows the adventures of a high school student, Marty McFly and an eccentric scientist, Dr Emmett L. Brown as they use a DeLorean time machine to time travel to different periods in the history of Hill Valley, California.,
|
||||
parts: [
|
||||
{
|
||||
original_title: Back to the Future,
|
||||
release_date: DateTime_1,
|
||||
title: Back to the Future,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
12,
|
||||
35,
|
||||
878,
|
||||
10751
|
||||
],
|
||||
original_language: en,
|
||||
overview: Eighties teenager Marty McFly is accidentally sent back in time to 1955, inadvertently disrupting his parents' first meeting and attracting his mother's romantic interest. Marty must repair the damage to history by rekindling his parents' romance and - with the help of his eccentric inventor friend Doc Brown - return to 1985.,
|
||||
poster_path: <non-empty>,
|
||||
id: 105,
|
||||
media_type: movie,
|
||||
},
|
||||
{
|
||||
original_title: Back to the Future Part II,
|
||||
release_date: DateTime_2,
|
||||
title: Back to the Future Part II,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
12,
|
||||
35,
|
||||
878,
|
||||
10751
|
||||
],
|
||||
original_language: en,
|
||||
overview: Marty and Doc are at it again in this wacky sequel to the 1985 blockbuster as the time-traveling duo head to 2015 to nip some McFly family woes in the bud. But things go awry thanks to bully Biff Tannen and a pesky sports almanac. In a last-ditch attempt to set things straight, Marty finds himself bound for 1955 and face to face with his teenage parents -- again.,
|
||||
poster_path: <non-empty>,
|
||||
id: 165,
|
||||
media_type: movie,
|
||||
},
|
||||
{
|
||||
original_title: Back to the Future Part III,
|
||||
release_date: DateTime_3,
|
||||
title: Back to the Future Part III,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
12,
|
||||
35,
|
||||
878
|
||||
],
|
||||
original_language: en,
|
||||
overview: The final installment of the Back to the Future trilogy finds Marty digging the trusty DeLorean out of a mineshaft and looking for Doc in the Wild West of 1885. But when their time machine breaks down, the travelers are stranded in a land of spurs. More problems arise when Doc falls for pretty schoolteacher Clara Clayton, and Marty tangles with Buford Tannen.,
|
||||
poster_path: <non-empty>,
|
||||
id: 196,
|
||||
media_type: movie,
|
||||
}
|
||||
],
|
||||
poster_path: <non-empty>
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
{
|
||||
backdrop_path: <non-empty>,
|
||||
id: 264,
|
||||
name: Back to the Future Collection,
|
||||
overview: An American science fiction–comedy film series that follows the adventures of a high school student, Marty McFly and an eccentric scientist, Dr Emmett L. Brown as they use a DeLorean time machine to time travel to different periods in the history of Hill Valley, California.,
|
||||
parts: [
|
||||
{
|
||||
original_title: Back to the Future,
|
||||
release_date: DateTime_1,
|
||||
title: Back to the Future,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
12,
|
||||
35,
|
||||
878,
|
||||
10751
|
||||
],
|
||||
original_language: en,
|
||||
overview: Eighties teenager Marty McFly is accidentally sent back in time to 1955, inadvertently disrupting his parents' first meeting and attracting his mother's romantic interest. Marty must repair the damage to history by rekindling his parents' romance and - with the help of his eccentric inventor friend Doc Brown - return to 1985.,
|
||||
poster_path: <non-empty>,
|
||||
id: 105,
|
||||
media_type: movie,
|
||||
},
|
||||
{
|
||||
original_title: Back to the Future Part II,
|
||||
release_date: DateTime_2,
|
||||
title: Back to the Future Part II,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
12,
|
||||
35,
|
||||
878,
|
||||
10751
|
||||
],
|
||||
original_language: en,
|
||||
overview: Marty and Doc are at it again in this wacky sequel to the 1985 blockbuster as the time-traveling duo head to 2015 to nip some McFly family woes in the bud. But things go awry thanks to bully Biff Tannen and a pesky sports almanac. In a last-ditch attempt to set things straight, Marty finds himself bound for 1955 and face to face with his teenage parents -- again.,
|
||||
poster_path: <non-empty>,
|
||||
id: 165,
|
||||
media_type: movie,
|
||||
},
|
||||
{
|
||||
original_title: Back to the Future Part III,
|
||||
release_date: DateTime_3,
|
||||
title: Back to the Future Part III,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
12,
|
||||
35,
|
||||
878
|
||||
],
|
||||
original_language: en,
|
||||
overview: The final installment of the Back to the Future trilogy finds Marty digging the trusty DeLorean out of a mineshaft and looking for Doc in the Wild West of 1885. But when their time machine breaks down, the travelers are stranded in a land of spurs. More problems arise when Doc falls for pretty schoolteacher Clara Clayton, and Marty tangles with Buford Tannen.,
|
||||
poster_path: <non-empty>,
|
||||
id: 196,
|
||||
media_type: movie,
|
||||
}
|
||||
],
|
||||
poster_path: <non-empty>
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
{
|
||||
description: ,
|
||||
headquarters: Century City, California, USA,
|
||||
homepage: http://www.foxmovies.com/,
|
||||
id: 25,
|
||||
logo_path: <non-empty>,
|
||||
movies: {
|
||||
page: 1,
|
||||
results: [
|
||||
{
|
||||
original_title: Ice Age,
|
||||
release_date: DateTime_1,
|
||||
title: Ice Age,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
12,
|
||||
16,
|
||||
35,
|
||||
10751
|
||||
],
|
||||
original_language: en,
|
||||
overview: With the impending ice age almost upon them, a mismatched trio of prehistoric critters – Manny the woolly mammoth, Diego the saber-toothed tiger and Sid the giant sloth – find an orphaned infant and decide to return it to its human parents. Along the way, the unlikely allies become friends but, when enemies attack, their quest takes on far nobler aims.,
|
||||
poster_path: <non-empty>,
|
||||
id: 425,
|
||||
media_type: movie,
|
||||
}
|
||||
],
|
||||
total_pages: 80,
|
||||
total_results: 1599
|
||||
},
|
||||
name: 20th Century Fox,
|
||||
origin_country: US
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
url: http://image.tmdb.org/t/p/original/qZCc1lty5FzX30aOCVRBLzaVmcp.png,
|
||||
urlSecure: https://image.tmdb.org/t/p/original/qZCc1lty5FzX30aOCVRBLzaVmcp.png
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
{
|
||||
images: {
|
||||
base_url: http://image.tmdb.org/t/p/,
|
||||
secure_base_url: https://image.tmdb.org/t/p/,
|
||||
backdrop_sizes: [
|
||||
w300,
|
||||
w780,
|
||||
w1280,
|
||||
original
|
||||
],
|
||||
logo_sizes: [
|
||||
w45,
|
||||
w92,
|
||||
w154,
|
||||
w185,
|
||||
w300,
|
||||
w500,
|
||||
original
|
||||
],
|
||||
poster_sizes: [
|
||||
w92,
|
||||
w154,
|
||||
w185,
|
||||
w342,
|
||||
w500,
|
||||
w780,
|
||||
original
|
||||
],
|
||||
profile_sizes: [
|
||||
w45,
|
||||
w185,
|
||||
h632,
|
||||
original
|
||||
],
|
||||
still_sizes: [
|
||||
w92,
|
||||
w185,
|
||||
w300,
|
||||
original
|
||||
]
|
||||
},
|
||||
change_keys: [
|
||||
adult,
|
||||
air_date,
|
||||
also_known_as,
|
||||
alternative_titles,
|
||||
biography,
|
||||
birthday,
|
||||
budget,
|
||||
cast,
|
||||
certifications,
|
||||
character_names,
|
||||
created_by,
|
||||
crew,
|
||||
deathday,
|
||||
episode,
|
||||
episode_number,
|
||||
episode_run_time,
|
||||
freebase_id,
|
||||
freebase_mid,
|
||||
general,
|
||||
genres,
|
||||
guest_stars,
|
||||
homepage,
|
||||
images,
|
||||
imdb_id,
|
||||
languages,
|
||||
name,
|
||||
network,
|
||||
origin_country,
|
||||
original_name,
|
||||
original_title,
|
||||
overview,
|
||||
parts,
|
||||
place_of_birth,
|
||||
plot_keywords,
|
||||
production_code,
|
||||
production_companies,
|
||||
production_countries,
|
||||
releases,
|
||||
revenue,
|
||||
runtime,
|
||||
season,
|
||||
season_number,
|
||||
season_regular,
|
||||
spoken_languages,
|
||||
status,
|
||||
tagline,
|
||||
title,
|
||||
translations,
|
||||
tvdb_id,
|
||||
tvrage_id,
|
||||
type,
|
||||
video,
|
||||
videos
|
||||
]
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
iso_3166_1: DK,
|
||||
english_name: Denmark
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
{
|
||||
department: Writing,
|
||||
jobs: [
|
||||
Dialogue,
|
||||
Theatre Play,
|
||||
Screenplay,
|
||||
Idea,
|
||||
Executive Story Editor,
|
||||
Writers' Production,
|
||||
Adaptation,
|
||||
Scenario Writer,
|
||||
Comic Book,
|
||||
Author,
|
||||
Other,
|
||||
Script Editor,
|
||||
Story Manager,
|
||||
Story Supervisor,
|
||||
Writer,
|
||||
Lyricist,
|
||||
Original Film Writer,
|
||||
Storyboard,
|
||||
Musical,
|
||||
Series Composition,
|
||||
Staff Writer,
|
||||
Novel,
|
||||
Story Artist,
|
||||
Book,
|
||||
Opera,
|
||||
Creative Producer,
|
||||
Characters,
|
||||
Original Story,
|
||||
Screenstory,
|
||||
Teleplay,
|
||||
Co-Writer,
|
||||
Short Story,
|
||||
Script Consultant,
|
||||
Writers' Assistant,
|
||||
Story,
|
||||
Story Editor,
|
||||
Original Series Creator,
|
||||
Junior Story Editor,
|
||||
Senior Story Editor,
|
||||
Story Consultant,
|
||||
Head of Story,
|
||||
Original Concept,
|
||||
Graphic Novel,
|
||||
Story Coordinator,
|
||||
Story Developer
|
||||
]
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
iso_639_1: da,
|
||||
english_name: Danish,
|
||||
name: Dansk
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
[
|
||||
Europe/Copenhagen
|
||||
]
|
@ -0,0 +1,62 @@
|
||||
{
|
||||
credit_type: Cast,
|
||||
department: Acting,
|
||||
id: 5256ccf519c2956ff607ca00,
|
||||
job: Actor,
|
||||
media: {
|
||||
character: Gregory House,
|
||||
id: 1408,
|
||||
name: House,
|
||||
original_name: House,
|
||||
seasons: [
|
||||
{
|
||||
poster_path: <non-empty>
|
||||
},
|
||||
{
|
||||
air_date: DateTime_1,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 1
|
||||
},
|
||||
{
|
||||
air_date: DateTime_2,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 2
|
||||
},
|
||||
{
|
||||
air_date: DateTime_3,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 3
|
||||
},
|
||||
{
|
||||
air_date: DateTime_4,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 4
|
||||
},
|
||||
{
|
||||
air_date: DateTime_5,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 5
|
||||
},
|
||||
{
|
||||
air_date: DateTime_6,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 6
|
||||
},
|
||||
{
|
||||
air_date: DateTime_7,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 7
|
||||
},
|
||||
{
|
||||
air_date: DateTime_8,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 8
|
||||
}
|
||||
]
|
||||
},
|
||||
media_type: tv,
|
||||
person: {
|
||||
id: 41419,
|
||||
name: Hugh Laurie
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
{
|
||||
credit_type: Cast,
|
||||
department: Acting,
|
||||
id: 525719bb760ee3776a1835d3,
|
||||
job: Actor,
|
||||
media: {
|
||||
character: Tony Amato,
|
||||
episodes: [
|
||||
{
|
||||
air_date: DateTime_1,
|
||||
episode_number: 7,
|
||||
name: No Exit,
|
||||
overview: Crockett and Tubbs reluctantly help government agents in their pursuit of a dangerous arms dealer.,
|
||||
season_number: 1,
|
||||
still_path: <non-empty>
|
||||
}
|
||||
],
|
||||
id: 1908,
|
||||
name: Miami Vice,
|
||||
original_name: Miami Vice,
|
||||
seasons: [
|
||||
{
|
||||
air_date: DateTime_2,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 1
|
||||
}
|
||||
]
|
||||
},
|
||||
media_type: tv,
|
||||
person: {
|
||||
id: 62,
|
||||
name: Bruce Willis
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
movie_results: [
|
||||
{
|
||||
original_title: The Terminator,
|
||||
release_date: DateTime_1,
|
||||
title: The Terminator,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
28,
|
||||
53,
|
||||
878
|
||||
],
|
||||
original_language: en,
|
||||
overview: In the post-apocalyptic future, reigning tyrannical supercomputers teleport a cyborg assassin known as the "Terminator" back to 1984 to kill Sarah Connor, whose unborn son is destined to lead insurgents against 21st century mechanical hegemony. Meanwhile, the human-resistance movement dispatches a lone warrior to safeguard Sarah. Can he stop the virtually indestructible killing machine?,
|
||||
poster_path: <non-empty>,
|
||||
id: 218,
|
||||
media_type: movie,
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
{
|
||||
person_results: [
|
||||
{
|
||||
gender: Male,
|
||||
known_for_department: Acting,
|
||||
known_for: [
|
||||
{
|
||||
original_title: Pulp Fiction,
|
||||
release_date: DateTime_1,
|
||||
title: Pulp Fiction,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
53,
|
||||
80
|
||||
],
|
||||
id: 680,
|
||||
media_type: movie,
|
||||
original_language: en,
|
||||
overview: A burger-loving hit man, his philosophical partner, a drug-addled gangster's moll and a washed-up boxer converge in this sprawling, comedic crime caper. Their adventures unfurl in three stories that ingeniously trip back and forth in time.,
|
||||
poster_path: <non-empty>,
|
||||
},
|
||||
{
|
||||
original_title: The Sixth Sense,
|
||||
release_date: DateTime_2,
|
||||
title: The Sixth Sense,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
18,
|
||||
53,
|
||||
9648
|
||||
],
|
||||
id: 745,
|
||||
media_type: movie,
|
||||
original_language: en,
|
||||
overview: An eight year old boy named Cole Sear, who believes he can see dead people, aids the help of a child psychologist named Malcolm Crowe.,
|
||||
poster_path: <non-empty>,
|
||||
},
|
||||
{
|
||||
original_title: Split,
|
||||
release_date: DateTime_3,
|
||||
title: Split,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
27,
|
||||
53
|
||||
],
|
||||
id: 381288,
|
||||
media_type: movie,
|
||||
original_language: en,
|
||||
overview: Though Kevin has evidenced 23 personalities to his trusted psychiatrist, Dr. Fletcher, there remains one still submerged who is set to materialize and dominate all the others. Compelled to abduct three teenage girls led by the willful, observant Casey, Kevin reaches a war for survival among all of those contained within him — as well as everyone around him — as the walls between his compartments shatter apart.,
|
||||
poster_path: <non-empty>,
|
||||
}
|
||||
],
|
||||
name: Bruce Willis,
|
||||
profile_path: <non-empty>,
|
||||
id: 62,
|
||||
media_type: person,
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
tv_results: [
|
||||
{
|
||||
first_air_date: DateTime_1,
|
||||
name: Breaking Bad,
|
||||
original_name: Breaking Bad,
|
||||
origin_country: [
|
||||
US
|
||||
],
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
18
|
||||
],
|
||||
original_language: en,
|
||||
overview: When Walter White, a New Mexico chemistry teacher, is diagnosed with Stage III cancer and given a prognosis of only two years left to live. He becomes filled with a sense of fearlessness and an unrelenting desire to secure his family's financial future at any cost as he enters the dangerous world of drugs and crime.,
|
||||
poster_path: <non-empty>,
|
||||
id: 1396,
|
||||
media_type: tv,
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
tv_episode_results: [
|
||||
{
|
||||
air_date: DateTime_1,
|
||||
episode_number: 1,
|
||||
id: 62085,
|
||||
name: Pilot,
|
||||
overview: When an unassuming high school chemistry teacher discovers he has a rare form of lung cancer, he decides to team up with a former student and create a top of the line crystal meth in a used RV, to provide for his family once he is gone.,
|
||||
production_code: ,
|
||||
season_number: 1,
|
||||
show_id: 1396,
|
||||
still_path: <non-empty>,
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
{
|
||||
tv_episode_results: [
|
||||
{
|
||||
air_date: DateTime_1,
|
||||
episode_number: 1,
|
||||
id: 202650,
|
||||
name: The Bishop Warms Up,
|
||||
overview: ,
|
||||
production_code: ,
|
||||
season_number: 5,
|
||||
show_id: 2635
|
||||
}
|
||||
],
|
||||
tv_season_results: [
|
||||
{
|
||||
air_date: DateTime_2,
|
||||
episode_count: 7,
|
||||
id: 3572,
|
||||
name: Season 1,
|
||||
overview: High school chemistry teacher Walter White's life is suddenly transformed by a dire medical diagnosis. Street-savvy former student Jesse Pinkman "teaches" Walter a new trade.,
|
||||
poster_path: <non-empty>,
|
||||
season_number: 1,
|
||||
show_id: 1396
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
{
|
||||
tv_results: [
|
||||
{
|
||||
first_air_date: DateTime_1,
|
||||
name: Breaking Bad,
|
||||
original_name: Breaking Bad,
|
||||
origin_country: [
|
||||
US
|
||||
],
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
18
|
||||
],
|
||||
original_language: en,
|
||||
overview: When Walter White, a New Mexico chemistry teacher, is diagnosed with Stage III cancer and given a prognosis of only two years left to live. He becomes filled with a sense of fearlessness and an unrelenting desire to secure his family's financial future at any cost as he enters the dangerous world of drugs and crime.,
|
||||
poster_path: <non-empty>,
|
||||
id: 1396,
|
||||
media_type: tv,
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
{
|
||||
genres: [
|
||||
{
|
||||
id: 12,
|
||||
name: Adventure
|
||||
},
|
||||
{
|
||||
id: 14,
|
||||
name: Fantasy
|
||||
},
|
||||
{
|
||||
id: 16,
|
||||
name: Animation
|
||||
},
|
||||
{
|
||||
id: 18,
|
||||
name: Drama
|
||||
},
|
||||
{
|
||||
id: 27,
|
||||
name: Horror
|
||||
},
|
||||
{
|
||||
id: 28,
|
||||
name: Action
|
||||
},
|
||||
{
|
||||
id: 35,
|
||||
name: Comedy
|
||||
},
|
||||
{
|
||||
id: 36,
|
||||
name: History
|
||||
},
|
||||
{
|
||||
id: 37,
|
||||
name: Western
|
||||
},
|
||||
{
|
||||
id: 53,
|
||||
name: Thriller
|
||||
},
|
||||
{
|
||||
id: 80,
|
||||
name: Crime
|
||||
},
|
||||
{
|
||||
id: 99,
|
||||
name: Documentary
|
||||
},
|
||||
{
|
||||
id: 878,
|
||||
name: Science Fiction
|
||||
},
|
||||
{
|
||||
id: 9648,
|
||||
name: Mystery
|
||||
},
|
||||
{
|
||||
id: 10402,
|
||||
name: Music
|
||||
},
|
||||
{
|
||||
id: 10749,
|
||||
name: Romance
|
||||
},
|
||||
{
|
||||
id: 10751,
|
||||
name: Family
|
||||
},
|
||||
{
|
||||
id: 10752,
|
||||
name: War
|
||||
},
|
||||
{
|
||||
id: 10770,
|
||||
name: TV Movie
|
||||
}
|
||||
],
|
||||
genresDanish: [
|
||||
{
|
||||
id: 12,
|
||||
name: Eventyr
|
||||
},
|
||||
{
|
||||
id: 14,
|
||||
name: Fantasy
|
||||
},
|
||||
{
|
||||
id: 16,
|
||||
name: Animation
|
||||
},
|
||||
{
|
||||
id: 18,
|
||||
name: Drama
|
||||
},
|
||||
{
|
||||
id: 27,
|
||||
name: Gyser
|
||||
},
|
||||
{
|
||||
id: 28,
|
||||
name: Action
|
||||
},
|
||||
{
|
||||
id: 35,
|
||||
name: Komedie
|
||||
},
|
||||
{
|
||||
id: 36,
|
||||
name: Historie
|
||||
},
|
||||
{
|
||||
id: 37,
|
||||
name: Western
|
||||
},
|
||||
{
|
||||
id: 53,
|
||||
name: Thriller
|
||||
},
|
||||
{
|
||||
id: 80,
|
||||
name: Kriminalitet
|
||||
},
|
||||
{
|
||||
id: 99,
|
||||
name: Documentary
|
||||
},
|
||||
{
|
||||
id: 878,
|
||||
name: Sci-fi
|
||||
},
|
||||
{
|
||||
id: 9648,
|
||||
name: Mysterium
|
||||
},
|
||||
{
|
||||
id: 10402,
|
||||
name: Musik
|
||||
},
|
||||
{
|
||||
id: 10749,
|
||||
name: Romantik
|
||||
},
|
||||
{
|
||||
id: 10751,
|
||||
name: Familie
|
||||
},
|
||||
{
|
||||
id: 10752,
|
||||
name: Krig
|
||||
},
|
||||
{
|
||||
id: 10770,
|
||||
name: TV film
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
{
|
||||
genres: [
|
||||
{
|
||||
id: 16,
|
||||
name: Animation
|
||||
},
|
||||
{
|
||||
id: 18,
|
||||
name: Drama
|
||||
},
|
||||
{
|
||||
id: 35,
|
||||
name: Comedy
|
||||
},
|
||||
{
|
||||
id: 37,
|
||||
name: Western
|
||||
},
|
||||
{
|
||||
id: 80,
|
||||
name: Crime
|
||||
},
|
||||
{
|
||||
id: 99,
|
||||
name: Documentary
|
||||
},
|
||||
{
|
||||
id: 9648,
|
||||
name: Mystery
|
||||
},
|
||||
{
|
||||
id: 10751,
|
||||
name: Family
|
||||
},
|
||||
{
|
||||
id: 10759,
|
||||
name: Action & Adventure
|
||||
},
|
||||
{
|
||||
id: 10762,
|
||||
name: Kids
|
||||
},
|
||||
{
|
||||
id: 10763,
|
||||
name: News
|
||||
},
|
||||
{
|
||||
id: 10764,
|
||||
name: Reality
|
||||
},
|
||||
{
|
||||
id: 10765,
|
||||
name: Sci-Fi & Fantasy
|
||||
},
|
||||
{
|
||||
id: 10766,
|
||||
name: Soap
|
||||
},
|
||||
{
|
||||
id: 10767,
|
||||
name: Talk
|
||||
},
|
||||
{
|
||||
id: 10768,
|
||||
name: War & Politics
|
||||
}
|
||||
],
|
||||
genresDanish: [
|
||||
{
|
||||
id: 16,
|
||||
name: Animation
|
||||
},
|
||||
{
|
||||
id: 18,
|
||||
name: Drama
|
||||
},
|
||||
{
|
||||
id: 35,
|
||||
name: Komedie
|
||||
},
|
||||
{
|
||||
id: 37,
|
||||
name: Western
|
||||
},
|
||||
{
|
||||
id: 80,
|
||||
name: Kriminalitet
|
||||
},
|
||||
{
|
||||
id: 99,
|
||||
name: Documentary
|
||||
},
|
||||
{
|
||||
id: 9648,
|
||||
name: Mysterium
|
||||
},
|
||||
{
|
||||
id: 10751,
|
||||
name: Familie
|
||||
},
|
||||
{
|
||||
id: 10759,
|
||||
name: Action og eventyr
|
||||
},
|
||||
{
|
||||
id: 10762,
|
||||
name: Børn
|
||||
},
|
||||
{
|
||||
id: 10763,
|
||||
name: Nyhed
|
||||
},
|
||||
{
|
||||
id: 10764,
|
||||
name: Virkelighed
|
||||
},
|
||||
{
|
||||
id: 10765,
|
||||
name: Sci-fi og Fantasy
|
||||
},
|
||||
{
|
||||
id: 10766,
|
||||
name: Sæbe
|
||||
},
|
||||
{
|
||||
id: 10767,
|
||||
name: Snakke
|
||||
},
|
||||
{
|
||||
id: 10768,
|
||||
name: Krig & Politik
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
{
|
||||
id: 47964,
|
||||
keywords: [
|
||||
{
|
||||
id: 258,
|
||||
name: bomb
|
||||
},
|
||||
{
|
||||
id: 591,
|
||||
name: cia
|
||||
},
|
||||
{
|
||||
id: 2139,
|
||||
name: russia
|
||||
},
|
||||
{
|
||||
id: 10685,
|
||||
name: escape
|
||||
},
|
||||
{
|
||||
id: 18074,
|
||||
name: courthouse
|
||||
},
|
||||
{
|
||||
id: 33705,
|
||||
name: agent
|
||||
},
|
||||
{
|
||||
id: 186447,
|
||||
name: rogue
|
||||
},
|
||||
{
|
||||
id: 186450,
|
||||
name: moscow, russia
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
{
|
||||
id: 1418,
|
||||
results: [
|
||||
{
|
||||
id: 5800,
|
||||
name: geek
|
||||
},
|
||||
{
|
||||
id: 5801,
|
||||
name: nerd
|
||||
},
|
||||
{
|
||||
id: 9713,
|
||||
name: friends
|
||||
},
|
||||
{
|
||||
id: 14760,
|
||||
name: scientist
|
||||
},
|
||||
{
|
||||
id: 156810,
|
||||
name: science
|
||||
},
|
||||
{
|
||||
id: 193171,
|
||||
name: sitcom
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
id: 33705,
|
||||
name: agent
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
{
|
||||
created_by: TMDbTestAccount,
|
||||
items: [
|
||||
{
|
||||
original_title: Evan Almighty,
|
||||
release_date: DateTime_1,
|
||||
title: Evan Almighty,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
14,
|
||||
35,
|
||||
10751
|
||||
],
|
||||
original_language: en,
|
||||
overview: Junior congressman Evan Baxter, whose wish is to "change the world" is heard by none other than God. When God appears with the perplexing request to build an ark, Evan is sure he is losing it.,
|
||||
poster_path: <non-empty>,
|
||||
id: 2698,
|
||||
media_type: movie,
|
||||
}
|
||||
],
|
||||
description: This is a test list,
|
||||
id: 528349d419c2954bd21ca0a8,
|
||||
iso_639_1: en,
|
||||
item_count: 1,
|
||||
name: Test list
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
created_by: TMDbTestAccount,
|
||||
description: ,
|
||||
iso_639_1: en,
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
{
|
||||
backdrop_path: <non-empty>,
|
||||
belongs_to_collection: {
|
||||
backdrop_path: <non-empty>,
|
||||
id: 1570,
|
||||
name: Die Hard Collection,
|
||||
poster_path: <non-empty>
|
||||
},
|
||||
budget: 92000000,
|
||||
genres: [
|
||||
{
|
||||
id: 28,
|
||||
name: Action
|
||||
},
|
||||
{
|
||||
id: 53,
|
||||
name: Thriller
|
||||
}
|
||||
],
|
||||
homepage: http://www.diehardmovie.com/,
|
||||
id: 47964,
|
||||
imdb_id: tt1606378,
|
||||
original_language: en,
|
||||
original_title: A Good Day to Die Hard,
|
||||
overview: Iconoclastic, take-no-prisoners cop John McClane, finds himself for the first time on foreign soil after traveling to Moscow to help his wayward son Jack - unaware that Jack is really a highly-trained CIA operative out to stop a nuclear weapons heist. With the Russian underworld in pursuit, and battling a countdown to war, the two McClanes discover that their opposing methods make them unstoppable heroes.,
|
||||
poster_path: <non-empty>,
|
||||
production_companies: [
|
||||
{
|
||||
id: 25,
|
||||
name: 20th Century Fox,
|
||||
logo_path: <non-empty>,
|
||||
origin_country: US
|
||||
},
|
||||
{
|
||||
id: 290,
|
||||
name: Ingenious Media,
|
||||
logo_path: <non-empty>,
|
||||
origin_country: GB
|
||||
},
|
||||
{
|
||||
id: 444,
|
||||
name: Dune Entertainment,
|
||||
logo_path: <non-empty>,
|
||||
origin_country: US
|
||||
},
|
||||
{
|
||||
id: 2735,
|
||||
name: Mid Atlantic Films,
|
||||
origin_country: HU
|
||||
},
|
||||
{
|
||||
id: 10893,
|
||||
name: Big Screen Productions,
|
||||
origin_country:
|
||||
},
|
||||
{
|
||||
id: 12292,
|
||||
name: Temple Hill Entertainment,
|
||||
logo_path: <non-empty>,
|
||||
origin_country: US
|
||||
},
|
||||
{
|
||||
id: 22213,
|
||||
name: TSG Entertainment,
|
||||
logo_path: <non-empty>,
|
||||
origin_country: US
|
||||
},
|
||||
{
|
||||
id: 34396,
|
||||
name: Giant Pictures,
|
||||
origin_country:
|
||||
},
|
||||
{
|
||||
id: 34397,
|
||||
name: Origo Film Group,
|
||||
origin_country:
|
||||
}
|
||||
],
|
||||
production_countries: [
|
||||
{
|
||||
Iso_3166_1: US,
|
||||
Name: United States of America
|
||||
}
|
||||
],
|
||||
release_date: DateTime_1,
|
||||
revenue: 304654182,
|
||||
runtime: 98,
|
||||
spoken_languages: [
|
||||
{
|
||||
Iso_639_1: en,
|
||||
Name: English
|
||||
},
|
||||
{
|
||||
Iso_639_1: ru,
|
||||
Name: Pусский
|
||||
}
|
||||
],
|
||||
status: Released,
|
||||
tagline: Yippee Ki-Yay Mother Russia,
|
||||
title: A Good Day to Die Hard,
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
id: 335984,
|
||||
imdb_id: tt1856101,
|
||||
facebook_id: BladeRunner2049,
|
||||
twitter_id: bladerunner,
|
||||
instagram_id: bladerunnermovie
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
{
|
||||
respUs: {
|
||||
id: 47964,
|
||||
titles: [
|
||||
{
|
||||
iso_3166_1: US,
|
||||
title: Die Hard 5: A Good Day to Die Hard,
|
||||
type: faux title
|
||||
},
|
||||
{
|
||||
iso_3166_1: US,
|
||||
title: Die Hard 5,
|
||||
type: informal title
|
||||
},
|
||||
{
|
||||
iso_3166_1: US,
|
||||
title: Duro de matar 5,
|
||||
type:
|
||||
},
|
||||
{
|
||||
iso_3166_1: US,
|
||||
title: Good Day to Die Hard, A,
|
||||
type:
|
||||
},
|
||||
{
|
||||
iso_3166_1: US,
|
||||
title: Die Hard 5 - A Good Day to Die Hard (2013),
|
||||
type: Alphabetical
|
||||
},
|
||||
{
|
||||
iso_3166_1: US,
|
||||
title: Die Hard 5 - A Good Day to Die Hard,
|
||||
type:
|
||||
}
|
||||
]
|
||||
},
|
||||
respFrench: {
|
||||
id: 47964,
|
||||
titles: [
|
||||
{
|
||||
iso_3166_1: FR,
|
||||
title: Die Hard 5 - Belle Journée Pour mourir,
|
||||
type: faux title
|
||||
},
|
||||
{
|
||||
iso_3166_1: FR,
|
||||
title: Die hard 5,
|
||||
type:
|
||||
}
|
||||
]
|
||||
},
|
||||
respCaDefault: {
|
||||
id: 47964,
|
||||
titles: [
|
||||
{
|
||||
iso_3166_1: CA,
|
||||
title: Une Belle journée pour crever,
|
||||
type:
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
cast: {
|
||||
cast_id: 1,
|
||||
character: John McClane,
|
||||
credit_id: 52fe4751c3a36847f812f049,
|
||||
id: 62,
|
||||
name: Bruce Willis,
|
||||
profile_path: <non-empty>,
|
||||
gender: Male,
|
||||
known_for_department: Acting,
|
||||
original_name: Bruce Willis,
|
||||
},
|
||||
crew: {
|
||||
credit_id: 5336b04a9251417db4000c80,
|
||||
department: Production,
|
||||
id: 3965,
|
||||
job: Casting,
|
||||
name: Deborah Aquila,
|
||||
gender: Female,
|
||||
known_for_department: Production,
|
||||
original_name: Deborah Aquila,
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
backdrop: {
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 720,
|
||||
iso_639_1: en,
|
||||
width: 1280
|
||||
},
|
||||
poster: {
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 2100,
|
||||
iso_639_1: it,
|
||||
width: 1400
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
backdrop: {
|
||||
aspect_ratio: 1.777777777777778,
|
||||
file_path: <non-empty>,
|
||||
height: 720,
|
||||
iso_639_1: en,
|
||||
width: 1280
|
||||
},
|
||||
poster: {
|
||||
aspect_ratio: 0.6666666666666666,
|
||||
file_path: <non-empty>,
|
||||
height: 2100,
|
||||
iso_639_1: en,
|
||||
width: 1400
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
{
|
||||
id: 47964,
|
||||
keywords: [
|
||||
{
|
||||
id: 258,
|
||||
name: bomb
|
||||
},
|
||||
{
|
||||
id: 591,
|
||||
name: cia
|
||||
},
|
||||
{
|
||||
id: 2139,
|
||||
name: russia
|
||||
},
|
||||
{
|
||||
id: 10685,
|
||||
name: escape
|
||||
},
|
||||
{
|
||||
id: 18074,
|
||||
name: courthouse
|
||||
},
|
||||
{
|
||||
id: 33705,
|
||||
name: agent
|
||||
},
|
||||
{
|
||||
id: 186447,
|
||||
name: rogue
|
||||
},
|
||||
{
|
||||
id: 186450,
|
||||
name: moscow, russia
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
{
|
||||
single: {
|
||||
original_title: Live Free or Die Hard,
|
||||
release_date: DateTime_1,
|
||||
title: Live Free or Die Hard,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
28,
|
||||
53
|
||||
],
|
||||
original_language: en,
|
||||
overview: John McClane is back and badder than ever, and this time he's working for Homeland Security. He calls on the services of a young hacker in his bid to stop a ring of Internet terrorists intent on taking control of America's computer infrastructure.,
|
||||
poster_path: <non-empty>,
|
||||
id: 1571,
|
||||
media_type: movie,
|
||||
},
|
||||
singleGerman: {
|
||||
original_title: Live Free or Die Hard,
|
||||
release_date: DateTime_1,
|
||||
title: Stirb langsam 4.0,
|
||||
backdrop_path: <non-empty>,
|
||||
genre_ids: [
|
||||
28,
|
||||
53
|
||||
],
|
||||
original_language: en,
|
||||
overview: Die gesamte USA wird von einem bisher unvorstellbaren Akt des Terrorismus bedroht, der sich innovativster Techniken bedient und mittels Computerkraft das Land ins Chaos zu stürzen vermag. Die IT-Infrastruktur des Landes wird komplett außer Kraft gesetzt, Kommunikation und Bankwesen liegen lahm und die überraschten Behörden wissen zunächst nichts entgegen zu setzen. Nur ein Mann kann den Terror aufhalten: Der New Yorker Polizist John McClane hält nichts von modernem Schnickschnack und macht sich auf seine eigene Art auf die Jagd nach dem Drahtzieher des spektakulären Coups. Unterstützt wird er dabei von dem jungen Greg, den McClane eigentlich nur von New Jersey nach Washington bringen sollte. Doch mal wieder ist der alte Haudegen zur falschen Zeit am falschen Ort…,
|
||||
poster_path: <non-empty>,
|
||||
id: 1571,
|
||||
media_type: movie,
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user