Renamed all public Async methods

#178
This commit is contained in:
Michael Bisbjerg 2016-02-22 21:55:27 +01:00
parent 8ce68c9d21
commit 5a8dc0ca9f
50 changed files with 624 additions and 624 deletions

View File

@ -155,7 +155,7 @@ namespace TMDbLib.Client
/// <param name="sessionId">The session id to use when making calls that require authentication</param>
/// <param name="sessionType">The type of session id</param>
/// <remarks>
/// - Use the 'AuthenticationGetUserSession' and 'AuthenticationCreateGuestSession' methods to optain the respective session ids.
/// - Use the 'AuthenticationGetUserSessionAsync' and 'AuthenticationCreateGuestSessionAsync' methods to optain the respective session ids.
/// - User sessions have access to far for methods than guest sessions, these can currently only be used to rate media.
/// </remarks>
public void SetSessionInformation(string sessionId, SessionType sessionType)
@ -174,7 +174,7 @@ namespace TMDbLib.Client
{
try
{
ActiveAccount = AccountGetDetails().Result;
ActiveAccount = AccountGetDetailsAsync().Result;
}
catch (Exception)
{

View File

@ -18,7 +18,7 @@ namespace TMDbLib.Client
/// </summary>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<AccountDetails> AccountGetDetails()
public async Task<AccountDetails> AccountGetDetailsAsync()
{
RequireSessionId(SessionType.UserSession);
@ -36,7 +36,7 @@ namespace TMDbLib.Client
/// </summary>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<SearchContainer<List>> AccountGetLists(int page = 1, string language = null)
public async Task<SearchContainer<List>> AccountGetListsAsync(int page = 1, string language = null)
{
RequireSessionId(SessionType.UserSession);
@ -67,7 +67,7 @@ namespace TMDbLib.Client
/// <returns>True if the the movie's favorite status was successfully updated, false if not</returns>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<bool> AccountChangeFavoriteStatus(MediaType mediaType, int mediaId, bool isFavorite)
public async Task<bool> AccountChangeFavoriteStatusAsync(MediaType mediaType, int mediaId, bool isFavorite)
{
RequireSessionId(SessionType.UserSession);
@ -93,7 +93,7 @@ namespace TMDbLib.Client
/// <returns>True if the the movie's status on the watchlist was successfully updated, false if not</returns>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<bool> AccountChangeWatchlistStatus(MediaType mediaType, int mediaId, bool isOnWatchlist)
public async Task<bool> AccountChangeWatchlistStatusAsync(MediaType mediaType, int mediaId, bool isOnWatchlist)
{
RequireSessionId(SessionType.UserSession);
@ -115,7 +115,7 @@ namespace TMDbLib.Client
/// </summary>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<SearchContainer<SearchMovie>> AccountGetFavoriteMovies(
public async Task<SearchContainer<SearchMovie>> AccountGetFavoriteMoviesAsync(
int page = 1,
AccountSortBy sortBy = AccountSortBy.Undefined,
SortOrder sortOrder = SortOrder.Undefined,
@ -129,7 +129,7 @@ namespace TMDbLib.Client
/// </summary>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<SearchContainer<SearchTv>> AccountGetFavoriteTv(
public async Task<SearchContainer<SearchTv>> AccountGetFavoriteTvAsync(
int page = 1,
AccountSortBy sortBy = AccountSortBy.Undefined,
SortOrder sortOrder = SortOrder.Undefined,
@ -143,7 +143,7 @@ namespace TMDbLib.Client
/// </summary>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<SearchContainer<SearchMovie>> AccountGetMovieWatchlist(
public async Task<SearchContainer<SearchMovie>> AccountGetMovieWatchlistAsync(
int page = 1,
AccountSortBy sortBy = AccountSortBy.Undefined,
SortOrder sortOrder = SortOrder.Undefined,
@ -157,7 +157,7 @@ namespace TMDbLib.Client
/// </summary>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<SearchContainer<SearchTv>> AccountGetTvWatchlist(
public async Task<SearchContainer<SearchTv>> AccountGetTvWatchlistAsync(
int page = 1,
AccountSortBy sortBy = AccountSortBy.Undefined,
SortOrder sortOrder = SortOrder.Undefined,
@ -171,7 +171,7 @@ namespace TMDbLib.Client
/// </summary>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<SearchContainer<SearchMovie>> AccountGetRatedMovies(
public async Task<SearchContainer<SearchMovie>> AccountGetRatedMoviesAsync(
int page = 1,
AccountSortBy sortBy = AccountSortBy.Undefined,
SortOrder sortOrder = SortOrder.Undefined,
@ -185,7 +185,7 @@ namespace TMDbLib.Client
/// </summary>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<SearchContainer<SearchTv>> AccountGetRatedTvShows(
public async Task<SearchContainer<SearchTv>> AccountGetRatedTvShowsAsync(
int page = 1,
AccountSortBy sortBy = AccountSortBy.Undefined,
SortOrder sortOrder = SortOrder.Undefined,
@ -199,7 +199,7 @@ namespace TMDbLib.Client
/// </summary>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<SearchContainer<SearchTvEpisode>> AccountGetRatedTvShowEpisodes(
public async Task<SearchContainer<SearchTvEpisode>> AccountGetRatedTvShowEpisodesAsync(
int page = 1,
AccountSortBy sortBy = AccountSortBy.Undefined,
SortOrder sortOrder = SortOrder.Undefined,

View File

@ -8,7 +8,7 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<Token> AuthenticationRequestAutenticationToken()
public async Task<Token> AuthenticationRequestAutenticationTokenAsync()
{
RestRequest request = _client.Create("authentication/token/new");
//{
@ -23,7 +23,7 @@ namespace TMDbLib.Client
return token;
}
public async Task AuthenticationValidateUserToken(string initialRequestToken, string username, string password)
public async Task AuthenticationValidateUserTokenAsync(string initialRequestToken, string username, string password)
{
RestRequest request = _client.Create("authentication/token/validate_with_login");
request.AddParameter("request_token", initialRequestToken);
@ -46,7 +46,7 @@ namespace TMDbLib.Client
}
}
public async Task<UserSession> AuthenticationGetUserSession(string initialRequestToken)
public async Task<UserSession> AuthenticationGetUserSessionAsync(string initialRequestToken)
{
RestRequest request = _client.Create("authentication/session/new");
request.AddParameter("request_token", initialRequestToken);
@ -60,18 +60,18 @@ namespace TMDbLib.Client
}
/// <summary>
/// Conveniance method combining 'AuthenticationRequestAutenticationToken', 'AuthenticationValidateUserToken' and 'AuthenticationGetUserSession'
/// Conveniance method combining 'AuthenticationRequestAutenticationTokenAsync', 'AuthenticationValidateUserTokenAsync' and 'AuthenticationGetUserSessionAsync'
/// </summary>
/// <param name="username">A valid TMDb username</param>
/// <param name="password">The passoword for the provided login</param>
public async Task<UserSession> AuthenticationGetUserSession(string username, string password)
public async Task<UserSession> AuthenticationGetUserSessionAsync(string username, string password)
{
Token token = await AuthenticationRequestAutenticationToken().ConfigureAwait(false);
await AuthenticationValidateUserToken(token.RequestToken, username, password).ConfigureAwait(false);
return await AuthenticationGetUserSession(token.RequestToken).ConfigureAwait(false);
Token token = await AuthenticationRequestAutenticationTokenAsync().ConfigureAwait(false);
await AuthenticationValidateUserTokenAsync(token.RequestToken, username, password).ConfigureAwait(false);
return await AuthenticationGetUserSessionAsync(token.RequestToken).ConfigureAwait(false);
}
public async Task<GuestSession> AuthenticationCreateGuestSession()
public async Task<GuestSession> AuthenticationCreateGuestSessionAsync()
{
RestRequest request = _client.Create("authentication/guest_session/new");
//{

View File

@ -6,7 +6,7 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<CertificationsContainer> GetMovieCertifications()
public async Task<CertificationsContainer> GetMovieCertificationsAsync()
{
RestRequest req = _client.Create("certification/movie/list");
@ -14,7 +14,7 @@ namespace TMDbLib.Client
return resp;}
public async Task<CertificationsContainer> GetTvCertifications()
public async Task<CertificationsContainer> GetTvCertificationsAsync()
{
RestRequest req = _client.Create("certification/tv/list");

View File

@ -29,10 +29,10 @@ namespace TMDbLib.Client
/// Get a list of movie ids that have been edited.
/// By default we show the last 24 hours and only 100 items per page.
/// The maximum number of days that can be returned in a single request is 14.
/// You can then use the movie changes API to get the actual data that has been changed. (.GetMovieChanges)
/// 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>> GetChangesMovies(int page = 0, DateTime? startDate = null, DateTime? endDate = null)
public async Task<SearchContainer<ChangesListItem>> GetChangesMoviesAsync(int page = 0, DateTime? startDate = null, DateTime? endDate = null)
{
return await GetChanges<SearchContainer<ChangesListItem>>("movie", page, startDate, endDate).ConfigureAwait(false);
}
@ -41,10 +41,10 @@ namespace TMDbLib.Client
/// Get a list of people ids that have been edited.
/// By default we show the last 24 hours and only 100 items per page.
/// The maximum number of days that can be returned in a single request is 14.
/// You can then use the person changes API to get the actual data that has been changed.(.GetPersonChanges)
/// 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>> GetChangesPeople(int page = 0, DateTime? startDate = null, DateTime? endDate = null)
public async Task<SearchContainer<ChangesListItem>> GetChangesPeopleAsync(int page = 0, DateTime? startDate = null, DateTime? endDate = null)
{
return await GetChanges<SearchContainer<ChangesListItem>>("person", page, startDate, endDate).ConfigureAwait(false);
}
@ -53,13 +53,13 @@ namespace TMDbLib.Client
/// Get a list of TV show ids that have been edited.
/// By default we show the last 24 hours and only 100 items per page.
/// The maximum number of days that can be returned in a single request is 14.
/// You can then use the TV changes API to get the actual data that has been changed. (.GetTvShowChanges)
/// You can then use the TV changes API to get the actual data that has been changed. (.GetTvShowChangesAsync)
/// </summary>
/// <remarks>
/// 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>> GetChangesTv(int page = 0, DateTime? startDate = null, DateTime? endDate = null)
public async Task<SearchContainer<ChangesListItem>> GetChangesTvAsync(int page = 0, DateTime? startDate = null, DateTime? endDate = null)
{
return await GetChanges<SearchContainer<ChangesListItem>>("tv", page, startDate, endDate).ConfigureAwait(false);
}

View File

@ -10,12 +10,12 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<Collection> GetCollection(int collectionId, CollectionMethods extraMethods = CollectionMethods.Undefined)
public async Task<Collection> GetCollectionAsync(int collectionId, CollectionMethods extraMethods = CollectionMethods.Undefined)
{
return await GetCollection(collectionId, DefaultLanguage, extraMethods).ConfigureAwait(false);
return await GetCollectionAsync(collectionId, DefaultLanguage, extraMethods).ConfigureAwait(false);
}
public async Task<Collection> GetCollection(int collectionId, string language, CollectionMethods extraMethods = CollectionMethods.Undefined)
public async Task<Collection> GetCollectionAsync(int collectionId, string language, CollectionMethods extraMethods = CollectionMethods.Undefined)
{
RestRequest req = _client.Create("collection/{collectionId}");
req.AddUrlSegment("collectionId", collectionId.ToString());
@ -55,7 +55,7 @@ namespace TMDbLib.Client
return resp;
}
public async Task<ImagesWithId> GetCollectionImages(int collectionId, string language = null)
public async Task<ImagesWithId> GetCollectionImagesAsync(int collectionId, string language = null)
{
return await GetCollectionMethod<ImagesWithId>(collectionId, CollectionMethods.Images, language).ConfigureAwait(false);
}

View File

@ -10,7 +10,7 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<Company> GetCompany(int companyId, CompanyMethods extraMethods = CompanyMethods.Undefined)
public async Task<Company> GetCompanyAsync(int companyId, CompanyMethods extraMethods = CompanyMethods.Undefined)
{
RestRequest req = _client.Create("company/{companyId}");
req.AddUrlSegment("companyId", companyId.ToString());
@ -49,12 +49,12 @@ namespace TMDbLib.Client
return resp;
}
public async Task<SearchContainerWithId<MovieResult>> GetCompanyMovies(int companyId, int page = 0)
public async Task<SearchContainerWithId<MovieResult>> GetCompanyMoviesAsync(int companyId, int page = 0)
{
return await GetCompanyMovies(companyId, DefaultLanguage, page).ConfigureAwait(false);
return await GetCompanyMoviesAsync(companyId, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainerWithId<MovieResult>> GetCompanyMovies(int companyId, string language, int page = 0)
public async Task<SearchContainerWithId<MovieResult>> GetCompanyMoviesAsync(int companyId, string language, int page = 0)
{
return await GetCompanyMethod<SearchContainerWithId<MovieResult>>(companyId, CompanyMethods.Movies, page, language).ConfigureAwait(false);
}

View File

@ -6,12 +6,12 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<Credit> GetCredits(string id)
public async Task<Credit> GetCreditsAsync(string id)
{
return await GetCredits(id, DefaultLanguage).ConfigureAwait(false);
return await GetCreditsAsync(id, DefaultLanguage).ConfigureAwait(false);
}
public async Task<Credit> GetCredits(string id, string language)
public async Task<Credit> GetCreditsAsync(string id, string language)
{
RestRequest req = _client.Create("credit/{id}");

View File

@ -12,7 +12,7 @@ namespace TMDbLib.Client
/// <summary>
/// Can be used to discover new tv shows matching certain criteria
/// </summary>
public DiscoverTv DiscoverTvShows()
public DiscoverTv DiscoverTvShowsAsync()
{
return new DiscoverTv(this);
}
@ -20,12 +20,12 @@ namespace TMDbLib.Client
/// <summary>
/// Can be used to discover movies matching certain criteria
/// </summary>
public DiscoverMovie DiscoverMovies()
public DiscoverMovie DiscoverMoviesAsync()
{
return new DiscoverMovie(this);
}
internal async Task<SearchContainer<T>> DiscoverPerform<T>(string endpoint, string language, int page, SimpleNamedValueCollection parameters)
internal async Task<SearchContainer<T>> DiscoverPerformAsync<T>(string endpoint, string language, int page, SimpleNamedValueCollection parameters)
{
RestRequest request = _client.Create(endpoint);

View File

@ -9,7 +9,7 @@ namespace TMDbLib.Client
public partial class TMDbClient
{
/// <summary>
/// Find movies, people and tv shows by an external id.
/// FindAsync movies, people and tv shows by an external id.
/// The following trypes can be found based on the specified external id's
/// - Movies: Imdb
/// - People: Imdb, FreeBaseMid, FreeBaseId, TvRage
@ -18,7 +18,7 @@ namespace TMDbLib.Client
/// <param name="source">The source the specified id belongs to</param>
/// <param name="id">The id of the object you wish to located</param>
/// <returns>A list of all objects in TMDb that matched your id</returns>
public async Task<FindContainer> Find(FindExternalSource source, string id)
public async Task<FindContainer> FindAsync(FindExternalSource source, string id)
{
RestRequest req = _client.Create("find/{id}");

View File

@ -8,12 +8,12 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<List<Genre>> GetMovieGenres()
public async Task<List<Genre>> GetMovieGenresAsync()
{
return await GetMovieGenres(DefaultLanguage).ConfigureAwait(false);
return await GetMovieGenresAsync(DefaultLanguage).ConfigureAwait(false);
}
public async Task<List<Genre>> GetMovieGenres(string language)
public async Task<List<Genre>> GetMovieGenresAsync(string language)
{
RestRequest req = _client.Create("genre/movie/list");
@ -26,12 +26,12 @@ namespace TMDbLib.Client
return (await resp.GetDataObject().ConfigureAwait(false)).Genres;
}
public async Task<List<Genre>> GetTvGenres()
public async Task<List<Genre>> GetTvGenresAsync()
{
return await GetTvGenres(DefaultLanguage).ConfigureAwait(false);
return await GetTvGenresAsync(DefaultLanguage).ConfigureAwait(false);
}
public async Task<List<Genre>> GetTvGenres(string language)
public async Task<List<Genre>> GetTvGenresAsync(string language)
{
RestRequest req = _client.Create("genre/tv/list");
@ -44,12 +44,12 @@ namespace TMDbLib.Client
return (await resp.GetDataObject().ConfigureAwait(false)).Genres;
}
public async Task<SearchContainerWithId<MovieResult>> GetGenreMovies(int genreId, int page = 0, bool? includeAllMovies = null)
public async Task<SearchContainerWithId<MovieResult>> GetGenreMoviesAsync(int genreId, int page = 0, bool? includeAllMovies = null)
{
return await GetGenreMovies(genreId, DefaultLanguage, page, includeAllMovies).ConfigureAwait(false);
return await GetGenreMoviesAsync(genreId, DefaultLanguage, page, includeAllMovies).ConfigureAwait(false);
}
public async Task<SearchContainerWithId<MovieResult>> GetGenreMovies(int genreId, string language, int page = 0, bool? includeAllMovies = null)
public async Task<SearchContainerWithId<MovieResult>> GetGenreMoviesAsync(int genreId, string language, int page = 0, bool? includeAllMovies = null)
{
RestRequest req = _client.Create("genre/{genreId}/movies");
req.AddUrlSegment("genreId", genreId.ToString());

View File

@ -9,12 +9,12 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<SearchContainer<TvEpisodeWithRating>> GetGuestSessionRatedTvEpisodes(int page = 0)
public async Task<SearchContainer<TvEpisodeWithRating>> GetGuestSessionRatedTvEpisodesAsync(int page = 0)
{
return await GetGuestSessionRatedTvEpisodes(DefaultLanguage, page).ConfigureAwait(false);
return await GetGuestSessionRatedTvEpisodesAsync(DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<TvEpisodeWithRating>> GetGuestSessionRatedTvEpisodes(string language, int page = 0)
public async Task<SearchContainer<TvEpisodeWithRating>> GetGuestSessionRatedTvEpisodesAsync(string language, int page = 0)
{
RequireSessionId(SessionType.GuestSession);
@ -33,12 +33,12 @@ namespace TMDbLib.Client
return resp;
}
public async Task<SearchContainer<TvShowWithRating>> GetGuestSessionRatedTv(int page = 0)
public async Task<SearchContainer<TvShowWithRating>> GetGuestSessionRatedTvAsync(int page = 0)
{
return await GetGuestSessionRatedTv(DefaultLanguage, page).ConfigureAwait(false);
return await GetGuestSessionRatedTvAsync(DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<TvShowWithRating>> GetGuestSessionRatedTv(string language, int page = 0)
public async Task<SearchContainer<TvShowWithRating>> GetGuestSessionRatedTvAsync(string language, int page = 0)
{
RequireSessionId(SessionType.GuestSession);
@ -57,12 +57,12 @@ namespace TMDbLib.Client
return resp;
}
public async Task<SearchContainer<MovieWithRating>> GetGuestSessionRatedMovies(int page = 0)
public async Task<SearchContainer<MovieWithRating>> GetGuestSessionRatedMoviesAsync(int page = 0)
{
return await GetGuestSessionRatedMovies(DefaultLanguage, page).ConfigureAwait(false);
return await GetGuestSessionRatedMoviesAsync(DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<MovieWithRating>> GetGuestSessionRatedMovies(string language, int page = 0)
public async Task<SearchContainer<MovieWithRating>> GetGuestSessionRatedMoviesAsync(string language, int page = 0)
{
RequireSessionId(SessionType.GuestSession);

View File

@ -12,7 +12,7 @@ namespace TMDbLib.Client
/// Retrieves a list of departments and positions within
/// </summary>
/// <returns>Valid jobs and their departments</returns>
public async Task<List<Job>> GetJobs()
public async Task<List<Job>> GetJobsAsync()
{
RestRequest req = _client.Create("job/list");

View File

@ -6,7 +6,7 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<Keyword> GetKeyword(int keywordId)
public async Task<Keyword> GetKeywordAsync(int keywordId)
{
RestRequest req = _client.Create("keyword/{keywordId}");
req.AddUrlSegment("keywordId", keywordId.ToString());
@ -16,12 +16,12 @@ namespace TMDbLib.Client
return resp;
}
public async Task<SearchContainer<MovieResult>> GetKeywordMovies(int keywordId, int page = 0)
public async Task<SearchContainer<MovieResult>> GetKeywordMoviesAsync(int keywordId, int page = 0)
{
return await GetKeywordMovies(keywordId, DefaultLanguage, page).ConfigureAwait(false);
return await GetKeywordMoviesAsync(keywordId, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<MovieResult>> GetKeywordMovies(int keywordId, string language, int page = 0)
public async Task<SearchContainer<MovieResult>> GetKeywordMoviesAsync(int keywordId, string language, int page = 0)
{
RestRequest req = _client.Create("keyword/{keywordId}/movies");
req.AddUrlSegment("keywordId", keywordId.ToString());

View File

@ -13,7 +13,7 @@ namespace TMDbLib.Client
/// Retrieve a list by it's id
/// </summary>
/// <param name="listId">The id of the list you want to retrieve</param>
public async Task<List> GetList(string listId)
public async Task<List> GetListAsync(string listId)
{
if (string.IsNullOrWhiteSpace(listId))
throw new ArgumentNullException("listId");
@ -31,7 +31,7 @@ namespace TMDbLib.Client
/// </summary>
/// <param name="listId">Id of the list to check in</param>
/// <param name="movieId">Id of the movie to check for in the list</param>
public async Task<bool> GetListIsMoviePresent(string listId, int movieId)
public async Task<bool> GetListIsMoviePresentAsync(string listId, int movieId)
{
if (string.IsNullOrWhiteSpace(listId))
throw new ArgumentNullException("listId");
@ -56,7 +56,7 @@ namespace TMDbLib.Client
/// <param name="language">Optional language that might indicate the language of the content in the list</param>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<string> ListCreate(string name, string description = "", string language = null)
public async Task<string> ListCreateAsync(string name, string description = "", string language = null)
{
RequireSessionId(SessionType.UserSession);
@ -92,7 +92,7 @@ namespace TMDbLib.Client
/// <param name="listId">A list id that is owned by the user associated with the current session id</param>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<bool> ListDelete(string listId)
public async Task<bool> ListDeleteAsync(string listId)
{
RequireSessionId(SessionType.UserSession);
@ -120,9 +120,9 @@ namespace TMDbLib.Client
/// <returns>True if the method was able to add the movie to the list, will retrun false in case of an issue or when the movie was already added to the list</returns>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<bool> ListAddMovie(string listId, int movieId)
public async Task<bool> ListAddMovieAsync(string listId, int movieId)
{
return await ManipulateMediaList(listId, movieId, "add_item").ConfigureAwait(false);
return await ManipulateMediaListAsync(listId, movieId, "add_item").ConfigureAwait(false);
}
/// <summary>
@ -133,9 +133,9 @@ namespace TMDbLib.Client
/// <returns>True if the method was able to remove the movie from the list, will retrun false in case of an issue or when the movie was not present in the list</returns>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<bool> ListRemoveMovie(string listId, int movieId)
public async Task<bool> ListRemoveMovieAsync(string listId, int movieId)
{
return await ManipulateMediaList(listId, movieId, "remove_item").ConfigureAwait(false);
return await ManipulateMediaListAsync(listId, movieId, "remove_item").ConfigureAwait(false);
}
/// <summary>
@ -145,7 +145,7 @@ namespace TMDbLib.Client
/// <returns>True if the method was able to remove the movie from the list, will retrun false in case of an issue or when the movie was not present in the list</returns>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<bool> ListClear(string listId)
public async Task<bool> ListClearAsync(string listId)
{
RequireSessionId(SessionType.UserSession);
@ -166,7 +166,7 @@ namespace TMDbLib.Client
return item.StatusCode == 12;
}
private async Task<bool> ManipulateMediaList(string listId, int movieId, string method)
private async Task<bool> ManipulateMediaListAsync(string listId, int movieId, string method)
{
RequireSessionId(SessionType.UserSession);

View File

@ -17,19 +17,19 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<Movie> GetMovie(int movieId, MovieMethods extraMethods = MovieMethods.Undefined)
public async Task<Movie> GetMovieAsync(int movieId, MovieMethods extraMethods = MovieMethods.Undefined)
{
return await GetMovie(movieId, DefaultLanguage, extraMethods).ConfigureAwait(false);
return await GetMovieAsync(movieId, DefaultLanguage, extraMethods).ConfigureAwait(false);
}
public async Task<Movie> GetMovie(string imdbId, MovieMethods extraMethods = MovieMethods.Undefined)
public async Task<Movie> GetMovieAsync(string imdbId, MovieMethods extraMethods = MovieMethods.Undefined)
{
return await GetMovie(imdbId, DefaultLanguage, extraMethods).ConfigureAwait(false);
return await GetMovieAsync(imdbId, DefaultLanguage, extraMethods).ConfigureAwait(false);
}
public async Task<Movie> GetMovie(int movieId, string language, MovieMethods extraMethods = MovieMethods.Undefined)
public async Task<Movie> GetMovieAsync(int movieId, string language, MovieMethods extraMethods = MovieMethods.Undefined)
{
return await GetMovie(movieId.ToString(CultureInfo.InvariantCulture), language, extraMethods).ConfigureAwait(false);
return await GetMovieAsync(movieId.ToString(CultureInfo.InvariantCulture), language, extraMethods).ConfigureAwait(false);
}
/// <summary>
@ -41,7 +41,7 @@ namespace TMDbLib.Client
/// <returns>The reqed movie or null if it could not be found</returns>
/// <remarks>Requires a valid user session when specifying the extra method 'AccountStates' flag</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned, see remarks.</exception>
public async Task<Movie> GetMovie(string imdbId, string language, MovieMethods extraMethods = MovieMethods.Undefined)
public async Task<Movie> GetMovieAsync(string imdbId, string language, MovieMethods extraMethods = MovieMethods.Undefined)
{
if (extraMethods.HasFlag(MovieMethods.AccountStates))
RequireSessionId(SessionType.UserSession);
@ -129,87 +129,87 @@ namespace TMDbLib.Client
return response;
}
public async Task<AlternativeTitles> GetMovieAlternativeTitles(int movieId)
public async Task<AlternativeTitles> GetMovieAlternativeTitlesAsync(int movieId)
{
return await GetMovieAlternativeTitles(movieId, DefaultCountry).ConfigureAwait(false);
return await GetMovieAlternativeTitlesAsync(movieId, DefaultCountry).ConfigureAwait(false);
}
public async Task<ResultContainer<ReleaseDatesContainer>> GetMovieReleaseDates(int movieId)
{
return await GetMovieMethod<ResultContainer<ReleaseDatesContainer>>(movieId, MovieMethods.ReleaseDates).ConfigureAwait(false);
}
public async Task<AlternativeTitles> GetMovieAlternativeTitles(int movieId, string country)
public async Task<AlternativeTitles> GetMovieAlternativeTitlesAsync(int movieId, string country)
{
return await GetMovieMethod<AlternativeTitles>(movieId, MovieMethods.AlternativeTitles, country: country).ConfigureAwait(false);
}
public async Task<Credits> GetMovieCredits(int movieId)
public async Task<ResultContainer<ReleaseDatesContainer>> GetMovieReleaseDatesAsync(int movieId)
{
return await GetMovieMethod<ResultContainer<ReleaseDatesContainer>>(movieId, MovieMethods.ReleaseDates).ConfigureAwait(false);
}
public async Task<Credits> GetMovieCreditsAsync(int movieId)
{
return await GetMovieMethod<Credits>(movieId, MovieMethods.Credits).ConfigureAwait(false);
}
public async Task<ImagesWithId> GetMovieImages(int movieId)
public async Task<ImagesWithId> GetMovieImagesAsync(int movieId)
{
return await GetMovieImages(movieId, DefaultLanguage).ConfigureAwait(false);
return await GetMovieImagesAsync(movieId, DefaultLanguage).ConfigureAwait(false);
}
public async Task<ImagesWithId> GetMovieImages(int movieId, string language)
public async Task<ImagesWithId> GetMovieImagesAsync(int movieId, string language)
{
return await GetMovieMethod<ImagesWithId>(movieId, MovieMethods.Images, language: language).ConfigureAwait(false);
}
public async Task<KeywordsContainer> GetMovieKeywords(int movieId)
public async Task<KeywordsContainer> GetMovieKeywordsAsync(int movieId)
{
return await GetMovieMethod<KeywordsContainer>(movieId, MovieMethods.Keywords).ConfigureAwait(false);
}
public async Task<Releases> GetMovieReleases(int movieId)
public async Task<Releases> GetMovieReleasesAsync(int movieId)
{
return await GetMovieMethod<Releases>(movieId, MovieMethods.Releases, dateFormat: "yyyy-MM-dd").ConfigureAwait(false);
}
public async Task<ResultContainer<Video>> GetMovieVideos(int movieId)
public async Task<ResultContainer<Video>> GetMovieVideosAsync(int movieId)
{
return await GetMovieMethod<ResultContainer<Video>>(movieId, MovieMethods.Videos).ConfigureAwait(false);
}
public async Task<TranslationsContainer> GetMovieTranslations(int movieId)
public async Task<TranslationsContainer> GetMovieTranslationsAsync(int movieId)
{
return await GetMovieMethod<TranslationsContainer>(movieId, MovieMethods.Translations).ConfigureAwait(false);
}
public async Task<SearchContainer<MovieResult>> GetMovieSimilar(int movieId, int page = 0)
public async Task<SearchContainer<MovieResult>> GetMovieSimilarAsync(int movieId, int page = 0)
{
return await GetMovieSimilar(movieId, DefaultLanguage, page).ConfigureAwait(false);
return await GetMovieSimilarAsync(movieId, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<MovieResult>> GetMovieSimilar(int movieId, string language, int page = 0)
public async Task<SearchContainer<MovieResult>> GetMovieSimilarAsync(int movieId, string language, int page = 0)
{
return await GetMovieMethod<SearchContainer<MovieResult>>(movieId, MovieMethods.Similar, page: page, language: language, dateFormat: "yyyy-MM-dd").ConfigureAwait(false);
}
public async Task<SearchContainer<Review>> GetMovieReviews(int movieId, int page = 0)
public async Task<SearchContainer<Review>> GetMovieReviewsAsync(int movieId, int page = 0)
{
return await GetMovieReviews(movieId, DefaultLanguage, page).ConfigureAwait(false);
return await GetMovieReviewsAsync(movieId, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<Review>> GetMovieReviews(int movieId, string language, int page = 0)
public async Task<SearchContainer<Review>> GetMovieReviewsAsync(int movieId, string language, int page = 0)
{
return await GetMovieMethod<SearchContainer<Review>>(movieId, MovieMethods.Reviews, page: page, language: language).ConfigureAwait(false);
}
public async Task<SearchContainer<ListResult>> GetMovieLists(int movieId, int page = 0)
public async Task<SearchContainer<ListResult>> GetMovieListsAsync(int movieId, int page = 0)
{
return await GetMovieLists(movieId, DefaultLanguage, page).ConfigureAwait(false);
return await GetMovieListsAsync(movieId, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<ListResult>> GetMovieLists(int movieId, string language, int page = 0)
public async Task<SearchContainer<ListResult>> GetMovieListsAsync(int movieId, string language, int page = 0)
{
return await GetMovieMethod<SearchContainer<ListResult>>(movieId, MovieMethods.Lists, page: page, language: language).ConfigureAwait(false);
}
public async Task<List<Change>> GetMovieChanges(int movieId, DateTime? startDate = null, DateTime? endDate = null)
public async Task<List<Change>> GetMovieChangesAsync(int movieId, DateTime? startDate = null, DateTime? endDate = null)
{
ChangesContainer changesContainer = await GetMovieMethod<ChangesContainer>(movieId, MovieMethods.Changes, startDate: startDate, endDate: endDate, dateFormat: "yyyy-MM-dd HH:mm:ss UTC").ConfigureAwait(false);
return changesContainer.Changes;
@ -221,7 +221,7 @@ namespace TMDbLib.Client
/// <param name="movieId">The id of the movie to get the account states for</param>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<AccountState> GetMovieAccountState(int movieId)
public async Task<AccountState> GetMovieAccountStateAsync(int movieId)
{
RequireSessionId(SessionType.UserSession);
@ -251,7 +251,7 @@ namespace TMDbLib.Client
/// <returns>True if the the movie's rating was successfully updated, false if not</returns>
/// <remarks>Requires a valid guest or user session</remarks>
/// <exception cref="GuestSessionRequiredException">Thrown when the current client object doens't have a guest or user session assigned.</exception>
public async Task<bool> MovieSetRating(int movieId, double rating)
public async Task<bool> MovieSetRatingAsync(int movieId, double rating)
{
RequireSessionId(SessionType.GuestSession);
@ -271,7 +271,7 @@ namespace TMDbLib.Client
return item.StatusCode == 1 || item.StatusCode == 12;
}
public async Task<bool> MovieRemoveRating(int movieId)
public async Task<bool> MovieRemoveRatingAsync(int movieId)
{
RequireSessionId(SessionType.GuestSession);
@ -288,7 +288,7 @@ namespace TMDbLib.Client
return item != null && item.StatusCode == 13;
}
public async Task<Movie> GetMovieLatest()
public async Task<Movie> GetMovieLatestAsync()
{
RestRequest req = _client.Create("movie/latest");
RestResponse<Movie> resp = await req.ExecuteGet<Movie>().ConfigureAwait(false);
@ -302,12 +302,12 @@ namespace TMDbLib.Client
return item;
}
public async Task<SearchContainer<MovieResult>> GetMovieList(MovieListType type, int page = 0)
public async Task<SearchContainer<MovieResult>> GetMovieListAsync(MovieListType type, int page = 0)
{
return await GetMovieList(type, DefaultLanguage, page).ConfigureAwait(false);
return await GetMovieListAsync(type, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<MovieResult>> GetMovieList(MovieListType type, string language, int page = 0)
public async Task<SearchContainer<MovieResult>> GetMovieListAsync(MovieListType type, string language, int page = 0)
{
RestRequest req;
switch (type)

View File

@ -11,7 +11,7 @@ namespace TMDbLib.Client
/// Retrieves a network by it's TMDb id. A network is a distributer of media content ex. HBO, AMC
/// </summary>
/// <param name="networkId">The id of the network object to retrieve</param>
public async Task<Network> GetNetwork(int networkId)
public async Task<Network> GetNetworkAsync(int networkId)
{
RestRequest req = _client.Create("network/{networkId}");
req.AddUrlSegment("networkId", networkId.ToString(CultureInfo.InvariantCulture));

View File

@ -12,7 +12,7 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<Person> GetPerson(int personId, PersonMethods extraMethods = PersonMethods.Undefined)
public async Task<Person> GetPersonAsync(int personId, PersonMethods extraMethods = PersonMethods.Undefined)
{
RestRequest req = _client.Create("person/{personId}");
req.AddUrlSegment("personId", personId.ToString());
@ -76,53 +76,53 @@ namespace TMDbLib.Client
return resp;
}
public async Task<MovieCredits> GetPersonMovieCredits(int personId)
public async Task<MovieCredits> GetPersonMovieCreditsAsync(int personId)
{
return await GetPersonMovieCredits(personId, DefaultLanguage).ConfigureAwait(false);
return await GetPersonMovieCreditsAsync(personId, DefaultLanguage).ConfigureAwait(false);
}
public async Task<MovieCredits> GetPersonMovieCredits(int personId, string language)
public async Task<MovieCredits> GetPersonMovieCreditsAsync(int personId, string language)
{
return await GetPersonMethod<MovieCredits>(personId, PersonMethods.MovieCredits, language: language).ConfigureAwait(false);
}
public async Task<TvCredits> GetPersonTvCredits(int personId)
public async Task<TvCredits> GetPersonTvCreditsAsync(int personId)
{
return await GetPersonTvCredits(personId, DefaultLanguage).ConfigureAwait(false);
return await GetPersonTvCreditsAsync(personId, DefaultLanguage).ConfigureAwait(false);
}
public async Task<TvCredits> GetPersonTvCredits(int personId, string language)
public async Task<TvCredits> GetPersonTvCreditsAsync(int personId, string language)
{
return await GetPersonMethod<TvCredits>(personId, PersonMethods.TvCredits, language: language).ConfigureAwait(false);
}
public async Task<ProfileImages> GetPersonImages(int personId)
public async Task<ProfileImages> GetPersonImagesAsync(int personId)
{
return await GetPersonMethod<ProfileImages>(personId, PersonMethods.Images).ConfigureAwait(false);
}
public async Task<SearchContainer<TaggedImage>> GetPersonTaggedImages(int personId, int page)
public async Task<SearchContainer<TaggedImage>> GetPersonTaggedImagesAsync(int personId, int page)
{
return await GetPersonTaggedImages(personId, DefaultLanguage, page).ConfigureAwait(false);
return await GetPersonTaggedImagesAsync(personId, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<TaggedImage>> GetPersonTaggedImages(int personId, string language, int page)
public async Task<SearchContainer<TaggedImage>> GetPersonTaggedImagesAsync(int personId, string language, int page)
{
return await GetPersonMethod<SearchContainer<TaggedImage>>(personId, PersonMethods.TaggedImages, language: language, page: page).ConfigureAwait(false);
}
public async Task<ExternalIds> GetPersonExternalIds(int personId)
public async Task<ExternalIds> GetPersonExternalIdsAsync(int personId)
{
return await GetPersonMethod<ExternalIds>(personId, PersonMethods.ExternalIds).ConfigureAwait(false);
}
public async Task<List<Change>> GetPersonChanges(int personId, DateTime? startDate = null, DateTime? endDate = null)
public async Task<List<Change>> GetPersonChangesAsync(int personId, DateTime? startDate = null, DateTime? endDate = null)
{
ChangesContainer changesContainer = await GetPersonMethod<ChangesContainer>(personId, PersonMethods.Changes, startDate: startDate, endDate: endDate, dateFormat: "yyyy-MM-dd HH:mm:ss UTC").ConfigureAwait(false);
return changesContainer.Changes;
}
public async Task<SearchContainer<PersonResult>> GetPersonList(PersonListType type, int page = 0)
public async Task<SearchContainer<PersonResult>> GetPersonListAsync(PersonListType type, int page = 0)
{
RestRequest req;
switch (type)
@ -145,7 +145,7 @@ namespace TMDbLib.Client
return resp;
}
public async Task<Person> GetLatestPerson()
public async Task<Person> GetLatestPersonAsync()
{
RestRequest req = _client.Create("person/latest");

View File

@ -6,7 +6,7 @@ namespace TMDbLib.Client
{
public partial class TMDbClient
{
public async Task<Review> GetReview(string reviewId)
public async Task<Review> GetReviewAsync(string reviewId)
{
RestRequest request = _client.Create("review/{reviewId}");
request.AddUrlSegment("reviewId", reviewId);

View File

@ -33,57 +33,57 @@ namespace TMDbLib.Client
return resp;
}
public async Task<SearchContainer<SearchMovie>> SearchMovie(string query, int page = 0, bool includeAdult = false, int year = 0)
public async Task<SearchContainer<SearchMovie>> SearchMovieAsync(string query, int page = 0, bool includeAdult = false, int year = 0)
{
return await SearchMovie(query, DefaultLanguage, page, includeAdult, year).ConfigureAwait(false);
return await SearchMovieAsync(query, DefaultLanguage, page, includeAdult, year).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchMovie>> SearchMovie(string query, string language, int page = 0, bool includeAdult = false, int year = 0)
public async Task<SearchContainer<SearchMovie>> SearchMovieAsync(string query, string language, int page = 0, bool includeAdult = false, int year = 0)
{
return await SearchMethod<SearchContainer<SearchMovie>>("movie", query, page, language, includeAdult, year, "yyyy-MM-dd").ConfigureAwait(false);
}
public async Task<SearchContainer<SearchMulti>> SearchMulti(string query, int page = 0, bool includeAdult = false, int year = 0)
public async Task<SearchContainer<SearchMulti>> SearchMultiAsync(string query, int page = 0, bool includeAdult = false, int year = 0)
{
return await SearchMulti(query, DefaultLanguage, page, includeAdult, year).ConfigureAwait(false);
return await SearchMultiAsync(query, DefaultLanguage, page, includeAdult, year).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchMulti>> SearchMulti(string query, string language, int page = 0, bool includeAdult = false, int year = 0)
public async Task<SearchContainer<SearchMulti>> SearchMultiAsync(string query, string language, int page = 0, bool includeAdult = false, int year = 0)
{
return await SearchMethod<SearchContainer<SearchMulti>>("multi", query, page, language, includeAdult, year, "yyyy-MM-dd").ConfigureAwait(false);
}
public async Task<SearchContainer<SearchResultCollection>> SearchCollection(string query, int page = 0)
public async Task<SearchContainer<SearchResultCollection>> SearchCollectionAsync(string query, int page = 0)
{
return await SearchCollection(query, DefaultLanguage, page).ConfigureAwait(false);
return await SearchCollectionAsync(query, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchResultCollection>> SearchCollection(string query, string language, int page = 0)
public async Task<SearchContainer<SearchResultCollection>> SearchCollectionAsync(string query, string language, int page = 0)
{
return await SearchMethod<SearchContainer<SearchResultCollection>>("collection", query, page, language).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchPerson>> SearchPerson(string query, int page = 0, bool includeAdult = false)
public async Task<SearchContainer<SearchPerson>> SearchPersonAsync(string query, int page = 0, bool includeAdult = false)
{
return await SearchMethod<SearchContainer<SearchPerson>>("person", query, page, includeAdult: includeAdult).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchList>> SearchList(string query, int page = 0, bool includeAdult = false)
public async Task<SearchContainer<SearchList>> SearchListAsync(string query, int page = 0, bool includeAdult = false)
{
return await SearchMethod<SearchContainer<SearchList>>("list", query, page, includeAdult: includeAdult).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchCompany>> SearchCompany(string query, int page = 0)
public async Task<SearchContainer<SearchCompany>> SearchCompanyAsync(string query, int page = 0)
{
return await SearchMethod<SearchContainer<SearchCompany>>("company", query, page).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchKeyword>> SearchKeyword(string query, int page = 0)
public async Task<SearchContainer<SearchKeyword>> SearchKeywordAsync(string query, int page = 0)
{
return await SearchMethod<SearchContainer<SearchKeyword>>("keyword", query, page).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchTv>> SearchTvShow(string query, int page = 0)
public async Task<SearchContainer<SearchTv>> SearchTvShowAsync(string query, int page = 0)
{
return await SearchMethod<SearchContainer<SearchTv>>("tv", query, page).ConfigureAwait(false);
}

View File

@ -9,7 +9,7 @@ namespace TMDbLib.Client
public partial class TMDbClient
{
/// <summary>
/// Find movies, people and tv shows by an external id.
/// FindAsync movies, people and tv shows by an external id.
/// The following trypes can be found based on the specified external id's
/// - Movies: Imdb
/// - People: Imdb, FreeBaseMid, FreeBaseId, TvRage
@ -18,7 +18,7 @@ namespace TMDbLib.Client
/// <param name="source">The source the specified id belongs to</param>
/// <param name="id">The id of the object you wish to located</param>
/// <returns>A list of all objects in TMDb that matched your id</returns>
public async Task<Timezones> GetTimezones()
public async Task<Timezones> GetTimezonesAsync()
{
RestRequest req = _client.Create("timezones/list");

View File

@ -23,7 +23,7 @@ namespace TMDbLib.Client
/// <param name="episodeNumber">The episode number of the episode you want to retrieve.</param>
/// <param name="extraMethods">Enum flags indicating any additional data that should be fetched in the same request.</param>
/// <param name="language">If specified the api will attempt to return a localized result. ex: en,it,es </param>
public async Task<TvEpisode> GetTvEpisode(int tvShowId, int seasonNumber, int episodeNumber, TvEpisodeMethods extraMethods = TvEpisodeMethods.Undefined, string language = null)
public async Task<TvEpisode> GetTvEpisodeAsync(int tvShowId, int seasonNumber, int episodeNumber, TvEpisodeMethods extraMethods = TvEpisodeMethods.Undefined, string language = null)
{
if (extraMethods.HasFlag(TvEpisodeMethods.AccountStates))
RequireSessionId(SessionType.UserSession);
@ -88,7 +88,7 @@ namespace TMDbLib.Client
/// <param name="seasonNumber">The season number of the season the episode belongs to. Note use 0 for specials.</param>
/// <param name="episodeNumber">The episode number of the episode you want to retrieve information for.</param>
/// <param name="language">If specified the api will attempt to return a localized result. ex: en,it,es </param>
public async Task<Credits> GetTvEpisodeCredits(int tvShowId, int seasonNumber, int episodeNumber, string language = null)
public async Task<Credits> GetTvEpisodeCreditsAsync(int tvShowId, int seasonNumber, int episodeNumber, string language = null)
{
return await GetTvEpisodeMethod<Credits>(tvShowId, seasonNumber, episodeNumber, TvEpisodeMethods.Credits, dateFormat: "yyyy-MM-dd", language: language).ConfigureAwait(false);
}
@ -103,7 +103,7 @@ namespace TMDbLib.Client
/// If specified the api will attempt to return a localized result. ex: en,it,es.
/// For images this means that the image might contain language specifc text
/// </param>
public async Task<StillImages> GetTvEpisodeImages(int tvShowId, int seasonNumber, int episodeNumber, string language = null)
public async Task<StillImages> GetTvEpisodeImagesAsync(int tvShowId, int seasonNumber, int episodeNumber, string language = null)
{
return await GetTvEpisodeMethod<StillImages>(tvShowId, seasonNumber, episodeNumber, TvEpisodeMethods.Images, language: language).ConfigureAwait(false);
}
@ -114,17 +114,17 @@ namespace TMDbLib.Client
/// <param name="tvShowId">The TMDb id of the target tv show.</param>
/// <param name="seasonNumber">The season number of the season the episode belongs to. Note use 0 for specials.</param>
/// <param name="episodeNumber">The episode number of the episode you want to retrieve information for.</param>
public async Task<ExternalIds> GetTvEpisodeExternalIds(int tvShowId, int seasonNumber, int episodeNumber)
public async Task<ExternalIds> GetTvEpisodeExternalIdsAsync(int tvShowId, int seasonNumber, int episodeNumber)
{
return await GetTvEpisodeMethod<ExternalIds>(tvShowId, seasonNumber, episodeNumber, TvEpisodeMethods.ExternalIds).ConfigureAwait(false);
}
public async Task<ResultContainer<Video>> GetTvEpisodeVideos(int tvShowId, int seasonNumber, int episodeNumber)
public async Task<ResultContainer<Video>> GetTvEpisodeVideosAsync(int tvShowId, int seasonNumber, int episodeNumber)
{
return await GetTvEpisodeMethod<ResultContainer<Video>>(tvShowId, seasonNumber, episodeNumber, TvEpisodeMethods.Videos).ConfigureAwait(false);
}
public async Task<TvEpisodeAccountState> GetTvEpisodeAccountState(int tvShowId, int seasonNumber, int episodeNumber)
public async Task<TvEpisodeAccountState> GetTvEpisodeAccountStateAsync(int tvShowId, int seasonNumber, int episodeNumber)
{
RequireSessionId(SessionType.UserSession);
@ -148,7 +148,7 @@ namespace TMDbLib.Client
return item;
}
public async Task<bool> TvEpisodeSetRating(int tvShowId, int seasonNumber, int episodeNumber, double rating)
public async Task<bool> TvEpisodeSetRatingAsync(int tvShowId, int seasonNumber, int episodeNumber, double rating)
{
RequireSessionId(SessionType.GuestSession);
@ -171,7 +171,7 @@ namespace TMDbLib.Client
return item.StatusCode == 1 || item.StatusCode == 12;
}
public async Task<bool> TvEpisodeRemoveRating(int tvShowId, int seasonNumber, int episodeNumber)
public async Task<bool> TvEpisodeRemoveRatingAsync(int tvShowId, int seasonNumber, int episodeNumber)
{
RequireSessionId(SessionType.GuestSession);
@ -191,7 +191,7 @@ namespace TMDbLib.Client
return item.StatusCode == 13;
}
public async Task<ChangesContainer> GetTvEpisodeChanges(int episodeId)
public async Task<ChangesContainer> GetTvEpisodeChangesAsync(int episodeId)
{
RestRequest req = _client.Create("tv/episode/{id}/changes");
req.AddUrlSegment("id", episodeId.ToString(CultureInfo.InvariantCulture));

View File

@ -23,7 +23,7 @@ namespace TMDbLib.Client
/// <param name="extraMethods">Enum flags indicating any additional data that should be fetched in the same request.</param>
/// <param name="language">If specified the api will attempt to return a localized result. ex: en,it,es </param>
/// <returns>The requested season for the specified tv show</returns>
public async Task<TvSeason> GetTvSeason(int tvShowId, int seasonNumber, TvSeasonMethods extraMethods = TvSeasonMethods.Undefined, string language = null)
public async Task<TvSeason> GetTvSeasonAsync(int tvShowId, int seasonNumber, TvSeasonMethods extraMethods = TvSeasonMethods.Undefined, string language = null)
{
if (extraMethods.HasFlag(TvSeasonMethods.AccountStates))
RequireSessionId(SessionType.UserSession);
@ -82,7 +82,7 @@ namespace TMDbLib.Client
/// <param name="tvShowId">The TMDb id of the target tv show.</param>
/// <param name="seasonNumber">The season number of the season you want to retrieve information for. Note use 0 for specials.</param>
/// <param name="language">If specified the api will attempt to return a localized result. ex: en,it,es </param>
public async Task<Credits> GetTvSeasonCredits(int tvShowId, int seasonNumber, string language = null)
public async Task<Credits> GetTvSeasonCreditsAsync(int tvShowId, int seasonNumber, string language = null)
{
return await GetTvSeasonMethod<Credits>(tvShowId, seasonNumber, TvSeasonMethods.Credits, dateFormat: "yyyy-MM-dd", language: language).ConfigureAwait(false);
}
@ -96,12 +96,12 @@ namespace TMDbLib.Client
/// If specified the api will attempt to return a localized result. ex: en,it,es.
/// For images this means that the image might contain language specifc text
/// </param>
public async Task<PosterImages> GetTvSeasonImages(int tvShowId, int seasonNumber, string language = null)
public async Task<PosterImages> GetTvSeasonImagesAsync(int tvShowId, int seasonNumber, string language = null)
{
return await GetTvSeasonMethod<PosterImages>(tvShowId, seasonNumber, TvSeasonMethods.Images, language: language).ConfigureAwait(false);
}
public async Task<ResultContainer<Video>> GetTvSeasonVideos(int tvShowId, int seasonNumber, string language = null)
public async Task<ResultContainer<Video>> GetTvSeasonVideosAsync(int tvShowId, int seasonNumber, string language = null)
{
return await GetTvSeasonMethod<ResultContainer<Video>>(tvShowId, seasonNumber, TvSeasonMethods.Videos, language: language).ConfigureAwait(false);
}
@ -111,12 +111,12 @@ namespace TMDbLib.Client
/// </summary>
/// <param name="tvShowId">The TMDb id of the target tv show.</param>
/// <param name="seasonNumber">The season number of the season you want to retrieve information for. Note use 0 for specials.</param>
public async Task<ExternalIds> GetTvSeasonExternalIds(int tvShowId, int seasonNumber)
public async Task<ExternalIds> GetTvSeasonExternalIdsAsync(int tvShowId, int seasonNumber)
{
return await GetTvSeasonMethod<ExternalIds>(tvShowId, seasonNumber, TvSeasonMethods.ExternalIds).ConfigureAwait(false);
}
public async Task<ResultContainer<TvEpisodeAccountState>> GetTvSeasonAccountState(int tvShowId, int seasonNumber)
public async Task<ResultContainer<TvEpisodeAccountState>> GetTvSeasonAccountStateAsync(int tvShowId, int seasonNumber)
{
RequireSessionId(SessionType.UserSession);
@ -139,7 +139,7 @@ namespace TMDbLib.Client
return item;
}
public async Task<ChangesContainer> GetTvSeasonChanges(int seasonId)
public async Task<ChangesContainer> GetTvSeasonChangesAsync(int seasonId)
{
RestRequest req = _client.Create("tv/season/{id}/changes");
req.AddUrlSegment("id", seasonId.ToString(CultureInfo.InvariantCulture));

View File

@ -23,7 +23,7 @@ namespace TMDbLib.Client
/// <param name="extraMethods">Enum flags indicating any additional data that should be fetched in the same request.</param>
/// <param name="language">If specified the api will attempt to return a localized result. ex: en,it,es </param>
/// <returns>The requested Tv Show</returns>
public async Task<TvShow> GetTvShow(int id, TvShowMethods extraMethods = TvShowMethods.Undefined, string language = null)
public async Task<TvShow> GetTvShowAsync(int id, TvShowMethods extraMethods = TvShowMethods.Undefined, string language = null)
{
if (extraMethods.HasFlag(TvShowMethods.AccountStates))
RequireSessionId(SessionType.UserSession);
@ -75,17 +75,17 @@ namespace TMDbLib.Client
/// </summary>
/// <returns>
/// Returns the basic information about a tv show.
/// For additional data use the main GetTvShow method using the tv show id as parameter.
/// For additional data use the main GetTvShowAsync method using the tv show id as parameter.
/// </returns>
public async Task<SearchContainer<SearchTv>> GetTvShowPopular(int page = -1, string language = null)
public async Task<SearchContainer<SearchTv>> GetTvShowPopularAsync(int page = -1, string language = null)
{
return await GetTvShowList(page, language, "popular").ConfigureAwait(false);
return await GetTvShowListAsync(page, language, "popular").ConfigureAwait(false);
}
[Obsolete("Use GetTvShowPopular")]
public async Task<SearchContainer<SearchTv>> GetTvShowsPopular(int page = -1, string language = null)
[Obsolete("Use GetTvShowPopularAsync")]
public async Task<SearchContainer<SearchTv>> GetTvShowsPopularAsync(int page = -1, string language = null)
{
return await GetTvShowPopular(page, language).ConfigureAwait(false);
return await GetTvShowPopularAsync(page, language).ConfigureAwait(false);
}
/// <summary>
@ -93,20 +93,20 @@ namespace TMDbLib.Client
/// </summary>
/// <returns>
/// Returns the basic information about a tv show.
/// For additional data use the main GetTvShow method using the tv show id as parameter
/// For additional data use the main GetTvShowAsync method using the tv show id as parameter
/// </returns>
public async Task<SearchContainer<SearchTv>> GetTvShowTopRated(int page = -1, string language = null)
public async Task<SearchContainer<SearchTv>> GetTvShowTopRatedAsync(int page = -1, string language = null)
{
return await GetTvShowList(page, language, "top_rated").ConfigureAwait(false);
return await GetTvShowListAsync(page, language, "top_rated").ConfigureAwait(false);
}
[Obsolete("Use GetTvShowTopRated")]
public async Task<SearchContainer<SearchTv>> GetTvShowsTopRated(int page = -1, string language = null)
[Obsolete("Use GetTvShowTopRatedAsync")]
public async Task<SearchContainer<SearchTv>> GetTvShowsTopRatedAsync(int page = -1, string language = null)
{
return await GetTvShowTopRated(page, language).ConfigureAwait(false);
return await GetTvShowTopRatedAsync(page, language).ConfigureAwait(false);
}
private async Task<SearchContainer<SearchTv>> GetTvShowList(int page, string language, string tvShowListType)
private async Task<SearchContainer<SearchTv>> GetTvShowListAsync(int page, string language, string tvShowListType)
{
RestRequest req = _client.Create("tv/" + tvShowListType);
@ -122,87 +122,6 @@ namespace TMDbLib.Client
return response;
}
/// <summary>
/// Returns a credits object for the tv show associated with the provided TMDb id.
/// </summary>
/// <param name="id">The TMDb id of the target tv show.</param>
/// <param name="language">If specified the api will attempt to return a localized result. ex: en,it,es </param>
public async Task<Credits> GetTvShowCredits(int id, string language = null)
{
return await GetTvShowMethod<Credits>(id, TvShowMethods.Credits, dateFormat: "yyyy-MM-dd", language: language).ConfigureAwait(false);
}
/// <summary>
/// Retrieves all images all related to the specified tv show.
/// </summary>
/// <param name="id">The TMDb id of the target tv show.</param>
/// <param name="language">
/// If specified the api will attempt to return a localized result. ex: en,it,es.
/// For images this means that the image might contain language specifc text
/// </param>
public async Task<ImagesWithId> GetTvShowImages(int id, string language = null)
{
return await GetTvShowMethod<ImagesWithId>(id, TvShowMethods.Images, language: language).ConfigureAwait(false);
}
/// <summary>
/// Returns an object that contains all known exteral id's for the tv show related to the specified TMDB id.
/// </summary>
/// <param name="id">The TMDb id of the target tv show.</param>
public async Task<ExternalIds> GetTvShowExternalIds(int id)
{
return await GetTvShowMethod<ExternalIds>(id, TvShowMethods.ExternalIds).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchTv>> GetTvShowSimilar(int id, int page = 0)
{
return await GetTvShowSimilar(id, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchTv>> GetTvShowSimilar(int id, string language, int page)
{
return await GetTvShowMethod<SearchContainer<SearchTv>>(id, TvShowMethods.Similar, language: language, page: page).ConfigureAwait(false);
}
public async Task<ResultContainer<ContentRating>> GetTvShowContentRatings(int id)
{
return await GetTvShowMethod<ResultContainer<ContentRating>>(id, TvShowMethods.ContentRatings).ConfigureAwait(false);
}
public async Task<ResultContainer<AlternativeTitle>> GetTvShowAlternativeTitles(int id)
{
return await GetTvShowMethod<ResultContainer<AlternativeTitle>>(id, TvShowMethods.AlternativeTitles).ConfigureAwait(false);
}
public async Task<ResultContainer<Keyword>> GetTvShowKeywords(int id)
{
return await GetTvShowMethod<ResultContainer<Keyword>>(id, TvShowMethods.Keywords).ConfigureAwait(false);
}
public async Task<ResultContainer<Video>> GetTvShowVideos(int id)
{
return await GetTvShowMethod<ResultContainer<Video>>(id, TvShowMethods.Videos).ConfigureAwait(false);
}
public async Task<TranslationsContainer> GetTvShowTranslations(int id)
{
return await GetTvShowMethod<TranslationsContainer>(id, TvShowMethods.Translations).ConfigureAwait(false);
}
public async Task<ChangesContainer> GetTvShowChanges(int id)
{
return await GetTvShowMethod<ChangesContainer>(id, TvShowMethods.Changes).ConfigureAwait(false);
}
public async Task<TvShow> GetLatestTvShow()
{
RestRequest req = _client.Create("tv/latest");
RestResponse<TvShow> resp = await req.ExecuteGet<TvShow>().ConfigureAwait(false);
return resp;
}
/// <summary>
/// Fetches a dynamic list of TV Shows
/// </summary>
@ -210,9 +129,9 @@ namespace TMDbLib.Client
/// <param name="page">Page</param>
/// <param name="timezone">Only relevant for list type AiringToday</param>
/// <returns></returns>
public async Task<SearchContainer<TvShow>> GetTvShowList(TvShowListType list, int page = 0, string timezone = null)
public async Task<SearchContainer<TvShow>> GetTvShowListAsync(TvShowListType list, int page = 0, string timezone = null)
{
return await GetTvShowList(list, DefaultLanguage, page, timezone).ConfigureAwait(false);
return await GetTvShowListAsync(list, DefaultLanguage, page, timezone).ConfigureAwait(false);
}
/// <summary>
@ -223,7 +142,7 @@ namespace TMDbLib.Client
/// <param name="page">Page</param>
/// <param name="timezone">Only relevant for list type AiringToday</param>
/// <returns></returns>
public async Task<SearchContainer<TvShow>> GetTvShowList(TvShowListType list, string language, int page = 0, string timezone = null)
public async Task<SearchContainer<TvShow>> GetTvShowListAsync(TvShowListType list, string language, int page = 0, string timezone = null)
{
RestRequest req = _client.Create("tv/{method}");
req.AddUrlSegment("method", list.GetDescription());
@ -243,6 +162,87 @@ namespace TMDbLib.Client
return resp;
}
/// <summary>
/// Returns a credits object for the tv show associated with the provided TMDb id.
/// </summary>
/// <param name="id">The TMDb id of the target tv show.</param>
/// <param name="language">If specified the api will attempt to return a localized result. ex: en,it,es </param>
public async Task<Credits> GetTvShowCreditsAsync(int id, string language = null)
{
return await GetTvShowMethod<Credits>(id, TvShowMethods.Credits, dateFormat: "yyyy-MM-dd", language: language).ConfigureAwait(false);
}
/// <summary>
/// Retrieves all images all related to the specified tv show.
/// </summary>
/// <param name="id">The TMDb id of the target tv show.</param>
/// <param name="language">
/// If specified the api will attempt to return a localized result. ex: en,it,es.
/// For images this means that the image might contain language specifc text
/// </param>
public async Task<ImagesWithId> GetTvShowImagesAsync(int id, string language = null)
{
return await GetTvShowMethod<ImagesWithId>(id, TvShowMethods.Images, language: language).ConfigureAwait(false);
}
/// <summary>
/// Returns an object that contains all known exteral id's for the tv show related to the specified TMDB id.
/// </summary>
/// <param name="id">The TMDb id of the target tv show.</param>
public async Task<ExternalIds> GetTvShowExternalIdsAsync(int id)
{
return await GetTvShowMethod<ExternalIds>(id, TvShowMethods.ExternalIds).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchTv>> GetTvShowSimilarAsync(int id, int page = 0)
{
return await GetTvShowSimilarAsync(id, DefaultLanguage, page).ConfigureAwait(false);
}
public async Task<SearchContainer<SearchTv>> GetTvShowSimilarAsync(int id, string language, int page)
{
return await GetTvShowMethod<SearchContainer<SearchTv>>(id, TvShowMethods.Similar, language: language, page: page).ConfigureAwait(false);
}
public async Task<ResultContainer<ContentRating>> GetTvShowContentRatingsAsync(int id)
{
return await GetTvShowMethod<ResultContainer<ContentRating>>(id, TvShowMethods.ContentRatings).ConfigureAwait(false);
}
public async Task<ResultContainer<AlternativeTitle>> GetTvShowAlternativeTitlesAsync(int id)
{
return await GetTvShowMethod<ResultContainer<AlternativeTitle>>(id, TvShowMethods.AlternativeTitles).ConfigureAwait(false);
}
public async Task<ResultContainer<Keyword>> GetTvShowKeywordsAsync(int id)
{
return await GetTvShowMethod<ResultContainer<Keyword>>(id, TvShowMethods.Keywords).ConfigureAwait(false);
}
public async Task<ResultContainer<Video>> GetTvShowVideosAsync(int id)
{
return await GetTvShowMethod<ResultContainer<Video>>(id, TvShowMethods.Videos).ConfigureAwait(false);
}
public async Task<TranslationsContainer> GetTvShowTranslationsAsync(int id)
{
return await GetTvShowMethod<TranslationsContainer>(id, TvShowMethods.Translations).ConfigureAwait(false);
}
public async Task<ChangesContainer> GetTvShowChangesAsync(int id)
{
return await GetTvShowMethod<ChangesContainer>(id, TvShowMethods.Changes).ConfigureAwait(false);
}
public async Task<TvShow> GetLatestTvShowAsync()
{
RestRequest req = _client.Create("tv/latest");
RestResponse<TvShow> resp = await req.ExecuteGet<TvShow>().ConfigureAwait(false);
return resp;
}
private async Task<T> GetTvShowMethod<T>(int id, TvShowMethods tvShowMethod, string dateFormat = null, string language = null, int page = 0) where T : new()
{
RestRequest req = _client.Create("tv/{id}/{method}");
@ -271,7 +271,7 @@ namespace TMDbLib.Client
/// <param name="tvShowId">The id of the tv show to get the account states for</param>
/// <remarks>Requires a valid user session</remarks>
/// <exception cref="UserSessionRequiredException">Thrown when the current client object doens't have a user session assigned.</exception>
public async Task<AccountState> GetTvShowAccountState(int tvShowId)
public async Task<AccountState> GetTvShowAccountStateAsync(int tvShowId)
{
RequireSessionId(SessionType.UserSession);
@ -301,7 +301,7 @@ namespace TMDbLib.Client
/// <returns>True if the the tv show's rating was successfully updated, false if not</returns>
/// <remarks>Requires a valid guest or user session</remarks>
/// <exception cref="GuestSessionRequiredException">Thrown when the current client object doens't have a guest or user session assigned.</exception>
public async Task<bool> TvShowSetRating(int tvShowId, double rating)
public async Task<bool> TvShowSetRatingAsync(int tvShowId, double rating)
{
RequireSessionId(SessionType.GuestSession);
@ -321,7 +321,7 @@ namespace TMDbLib.Client
return item.StatusCode == 1 || item.StatusCode == 12;
}
public async Task<bool> TvShowRemoveRating(int tvShowId)
public async Task<bool> TvShowRemoveRatingAsync(int tvShowId)
{
RequireSessionId(SessionType.GuestSession);

View File

@ -25,7 +25,7 @@ namespace TMDbLib.Objects.Discover
public async Task<SearchContainer<T>> Query(string language, int page = 0)
{
return await _client.DiscoverPerform<T>(_endpoint, language, page, Parameters).ConfigureAwait(false);
return await _client.DiscoverPerformAsync<T>(_endpoint, language, page, Parameters).ConfigureAwait(false);
}
}
}

View File

@ -36,7 +36,7 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.GuestTestSessionId, SessionType.GuestSession);
try
{
_config.Client.AccountGetDetails().Wait();
_config.Client.AccountGetDetailsAsync().Wait();
}
catch (AggregateException ex)
{
@ -51,7 +51,7 @@ namespace TMDbLibTests
public void TestAccountGetDetailsUserAccount()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
AccountDetails account = _config.Client.AccountGetDetails().Result;
AccountDetails account = _config.Client.AccountGetDetailsAsync().Result;
// Naturally the specified account must have these values populated for the test to pass
Assert.IsNotNull(account);
@ -70,8 +70,8 @@ namespace TMDbLibTests
public void TestAccountAccountGetLists()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestHelpers.SearchPages(i => _config.Client.AccountGetLists(i).Result);
List list = _config.Client.AccountGetLists().Result.Results[0];
TestHelpers.SearchPages(i => _config.Client.AccountGetListsAsync(i).Result);
List list = _config.Client.AccountGetListsAsync().Result.Results[0];
Assert.IsNotNull(list.Id);
Assert.IsNotNull(list.Name);
@ -87,8 +87,8 @@ namespace TMDbLibTests
public void TestAccountGetFavoriteMovies()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestHelpers.SearchPages(i => _config.Client.AccountGetFavoriteMovies(i).Result);
SearchMovie movie = _config.Client.AccountGetFavoriteMovies().Result.Results[0];
TestHelpers.SearchPages(i => _config.Client.AccountGetFavoriteMoviesAsync(i).Result);
SearchMovie movie = _config.Client.AccountGetFavoriteMoviesAsync().Result.Results[0];
// Requires that you have marked at least one movie as favorite else this test will fail
Assert.IsTrue(movie.Id > 0);
@ -111,8 +111,8 @@ namespace TMDbLibTests
public void TestAccountGetFavoriteTv()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestHelpers.SearchPages(i => _config.Client.AccountGetFavoriteTv(i).Result);
SearchTv tvShow = _config.Client.AccountGetFavoriteTv().Result.Results[0];
TestHelpers.SearchPages(i => _config.Client.AccountGetFavoriteTvAsync(i).Result);
SearchTv tvShow = _config.Client.AccountGetFavoriteTvAsync().Result.Results[0];
// Requires that you have marked at least one movie as favorite else this test will fail
Assert.IsTrue(tvShow.Id > 0);
@ -135,8 +135,8 @@ namespace TMDbLibTests
public void TestAccountGetMovieWatchlist()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestHelpers.SearchPages(i => _config.Client.AccountGetFavoriteMovies(i).Result);
SearchMovie movie = _config.Client.AccountGetFavoriteMovies().Result.Results[0];
TestHelpers.SearchPages(i => _config.Client.AccountGetFavoriteMoviesAsync(i).Result);
SearchMovie movie = _config.Client.AccountGetFavoriteMoviesAsync().Result.Results[0];
// Requires that you have added at least one movie to your watchlist else this test will fail
Assert.IsTrue(movie.Id > 0);
@ -159,8 +159,8 @@ namespace TMDbLibTests
public void TestAccountGetTvWatchlist()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestHelpers.SearchPages(i => _config.Client.AccountGetTvWatchlist(i).Result);
SearchTv tvShow = _config.Client.AccountGetTvWatchlist().Result.Results[0];
TestHelpers.SearchPages(i => _config.Client.AccountGetTvWatchlistAsync(i).Result);
SearchTv tvShow = _config.Client.AccountGetTvWatchlistAsync().Result.Results[0];
// Requires that you have added at least one movie to your watchlist else this test will fail
Assert.IsTrue(tvShow.Id > 0);
@ -183,8 +183,8 @@ namespace TMDbLibTests
public void TestAccountGetRatedMovies()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestHelpers.SearchPages(i => _config.Client.AccountGetFavoriteMovies(i).Result);
SearchMovie movie = _config.Client.AccountGetFavoriteMovies().Result.Results[0];
TestHelpers.SearchPages(i => _config.Client.AccountGetFavoriteMoviesAsync(i).Result);
SearchMovie movie = _config.Client.AccountGetFavoriteMoviesAsync().Result.Results[0];
// Requires that you have rated at least one movie else this test will fail
Assert.IsTrue(movie.Id > 0);
@ -207,8 +207,8 @@ namespace TMDbLibTests
public void TestAccountGetRatedTv()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestHelpers.SearchPages(i => _config.Client.AccountGetRatedTvShows(i).Result);
SearchTv tvShow = _config.Client.AccountGetRatedTvShows().Result.Results[0];
TestHelpers.SearchPages(i => _config.Client.AccountGetRatedTvShowsAsync(i).Result);
SearchTv tvShow = _config.Client.AccountGetRatedTvShowsAsync().Result.Results[0];
// Requires that you have rated at least one movie else this test will fail
Assert.IsTrue(tvShow.Id > 0);
@ -232,8 +232,8 @@ namespace TMDbLibTests
{
// TODO: Error in TMDb: https://www.themoviedb.org/talk/557f1af49251410a2c002480
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestHelpers.SearchPages(i => _config.Client.AccountGetRatedTvShowEpisodes(i).Result);
SearchTvEpisode tvEpisode = _config.Client.AccountGetRatedTvShowEpisodes().Result.Results[0];
TestHelpers.SearchPages(i => _config.Client.AccountGetRatedTvShowEpisodesAsync(i).Result);
SearchTvEpisode tvEpisode = _config.Client.AccountGetRatedTvShowEpisodesAsync().Result.Results[0];
// Requires that you have rated at least one movie else this test will fail
Assert.IsTrue(tvEpisode.Id > 0);
@ -257,13 +257,13 @@ namespace TMDbLibTests
Assert.Fail("Test tv show '{0}' was already marked as favorite. Unable to perform test correctly", IdHelper.DoctorWho);
// Try to mark is as a favorite
Assert.IsTrue(_config.Client.AccountChangeFavoriteStatus(MediaType.TVShow, IdHelper.DoctorWho, true).Result);
Assert.IsTrue(_config.Client.AccountChangeFavoriteStatusAsync(MediaType.TVShow, IdHelper.DoctorWho, true).Result);
// Check if it worked
Assert.IsTrue(DoesFavoriteListContainSpecificTvShow(IdHelper.DoctorWho));
// Try to un-mark is as a favorite
Assert.IsTrue(_config.Client.AccountChangeFavoriteStatus(MediaType.TVShow, IdHelper.DoctorWho, false).Result);
Assert.IsTrue(_config.Client.AccountChangeFavoriteStatusAsync(MediaType.TVShow, IdHelper.DoctorWho, false).Result);
// Check if it worked
Assert.IsFalse(DoesFavoriteListContainSpecificTvShow(IdHelper.DoctorWho));
@ -279,13 +279,13 @@ namespace TMDbLibTests
Assert.Fail("Test movie '{0}' was already marked as favorite. Unable to perform test correctly", IdHelper.Terminator);
// Try to mark is as a favorite
Assert.IsTrue(_config.Client.AccountChangeFavoriteStatus(MediaType.Movie, IdHelper.Terminator, true).Result);
Assert.IsTrue(_config.Client.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.Terminator, true).Result);
// Check if it worked
Assert.IsTrue(DoesFavoriteListContainSpecificMovie(IdHelper.Terminator));
// Try to un-mark is as a favorite
Assert.IsTrue(_config.Client.AccountChangeFavoriteStatus(MediaType.Movie, IdHelper.Terminator, false).Result);
Assert.IsTrue(_config.Client.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.Terminator, false).Result);
// Check if it worked
Assert.IsFalse(DoesFavoriteListContainSpecificMovie(IdHelper.Terminator));
@ -301,13 +301,13 @@ namespace TMDbLibTests
Assert.Fail("Test tv show '{0}' was already on watchlist. Unable to perform test correctly", IdHelper.DoctorWho);
// Try to add an item to the watchlist
Assert.IsTrue(_config.Client.AccountChangeWatchlistStatus(MediaType.TVShow, IdHelper.DoctorWho, true).Result);
Assert.IsTrue(_config.Client.AccountChangeWatchlistStatusAsync(MediaType.TVShow, IdHelper.DoctorWho, true).Result);
// Check if it worked
Assert.IsTrue(DoesWatchListContainSpecificTvShow(IdHelper.DoctorWho));
// Try to remove item from watchlist
Assert.IsTrue(_config.Client.AccountChangeWatchlistStatus(MediaType.TVShow, IdHelper.DoctorWho, false).Result);
Assert.IsTrue(_config.Client.AccountChangeWatchlistStatusAsync(MediaType.TVShow, IdHelper.DoctorWho, false).Result);
// Check if it worked
Assert.IsFalse(DoesWatchListContainSpecificTvShow(IdHelper.DoctorWho));
@ -323,13 +323,13 @@ namespace TMDbLibTests
Assert.Fail("Test movie '{0}' was already on watchlist. Unable to perform test correctly", IdHelper.Terminator);
// Try to add an item to the watchlist
Assert.IsTrue(_config.Client.AccountChangeWatchlistStatus(MediaType.Movie, IdHelper.Terminator, true).Result);
Assert.IsTrue(_config.Client.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.Terminator, true).Result);
// Check if it worked
Assert.IsTrue(DoesWatchListContainSpecificMovie(IdHelper.Terminator));
// Try to remove item from watchlist
Assert.IsTrue(_config.Client.AccountChangeWatchlistStatus(MediaType.Movie, IdHelper.Terminator, false).Result);
Assert.IsTrue(_config.Client.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.Terminator, false).Result);
// Check if it worked
Assert.IsFalse(DoesWatchListContainSpecificMovie(IdHelper.Terminator));
@ -337,22 +337,22 @@ namespace TMDbLibTests
private bool DoesFavoriteListContainSpecificTvShow(int tvId)
{
return DoesListContainSpecificMovie(tvId, page => _config.Client.AccountGetFavoriteTv(page).Result.Results.Select(s => s.Id));
return DoesListContainSpecificMovie(tvId, page => _config.Client.AccountGetFavoriteTvAsync(page).Result.Results.Select(s => s.Id));
}
private bool DoesWatchListContainSpecificTvShow(int tvId)
{
return DoesListContainSpecificMovie(tvId, page => _config.Client.AccountGetTvWatchlist(page).Result.Results.Select(s => s.Id));
return DoesListContainSpecificMovie(tvId, page => _config.Client.AccountGetTvWatchlistAsync(page).Result.Results.Select(s => s.Id));
}
private bool DoesFavoriteListContainSpecificMovie(int movieId)
{
return DoesListContainSpecificMovie(movieId, page => _config.Client.AccountGetFavoriteMovies(page).Result.Results.Select(s => s.Id));
return DoesListContainSpecificMovie(movieId, page => _config.Client.AccountGetFavoriteMoviesAsync(page).Result.Results.Select(s => s.Id));
}
private bool DoesWatchListContainSpecificMovie(int movieId)
{
return DoesListContainSpecificMovie(movieId, page => _config.Client.AccountGetMovieWatchlist(page).Result.Results.Select(s => s.Id));
return DoesListContainSpecificMovie(movieId, page => _config.Client.AccountGetMovieWatchlistAsync(page).Result.Results.Select(s => s.Id));
}
private bool DoesListContainSpecificMovie(int movieId, Func<int, IEnumerable<int>> listGetter)

View File

@ -28,7 +28,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestAuthenticationRequestNewToken()
{
Token token = _config.Client.AuthenticationRequestAutenticationToken().Result;
Token token = _config.Client.AuthenticationRequestAutenticationTokenAsync().Result;
Assert.IsNotNull(token);
Assert.IsTrue(token.Success);
@ -39,7 +39,7 @@ namespace TMDbLibTests
//<remarks>
//This requires manual intervention, as such it can not be included with the regular test set
//To be able to execute this test request a token using the AuthenticationRequestAutenticationToken method.
//To be able to execute this test request a token using the AuthenticationRequestAutenticationTokenAsync method.
//Subsequently naviate to the AuthenticationCallback url specified on the returned object.
//Log-in to a TMDb account and grant access when requested.
//Use the RequestToken string previously provided as value for this test
@ -48,7 +48,7 @@ namespace TMDbLibTests
//public void TestAuthenticationUserAuthenticatedSessionSuccess()
//{
// const string requestToken = "cb49e29af0473e78a4a489c91c6a8259407a343b";
// UserSession session = _config.Client.AuthenticationGetUserSession(requestToken);
// UserSession session = _config.Client.AuthenticationGetUserSessionAsync(requestToken);
// Assert.IsNotNull(session);
// Assert.IsTrue(session.Success);
@ -63,7 +63,7 @@ namespace TMDbLibTests
try
{
_config.Client.AuthenticationGetUserSession(requestToken).Wait();
_config.Client.AuthenticationGetUserSessionAsync(requestToken).Wait();
}
catch (AggregateException ex)
{
@ -80,20 +80,20 @@ namespace TMDbLibTests
[TestMethod]
public void TestAuthenticationGetUserSessionApiUserValidationSuccess()
{
Token token = _config.Client.AuthenticationRequestAutenticationToken().Result;
Token token = _config.Client.AuthenticationRequestAutenticationTokenAsync().Result;
_config.Client.AuthenticationValidateUserToken(token.RequestToken, _config.Username, _config.Password).Wait();
_config.Client.AuthenticationValidateUserTokenAsync(token.RequestToken, _config.Username, _config.Password).Wait();
}
[TestMethod]
[ExpectedException(typeof(UnauthorizedAccessException))]
public void TestAuthenticationGetUserSessionApiUserValidationInvalidLogin()
{
Token token = _config.Client.AuthenticationRequestAutenticationToken().Result;
Token token = _config.Client.AuthenticationRequestAutenticationTokenAsync().Result;
try
{
_config.Client.AuthenticationValidateUserToken(token.RequestToken, "bla", "bla").Wait();
_config.Client.AuthenticationValidateUserTokenAsync(token.RequestToken, "bla", "bla").Wait();
}
catch (AggregateException ex)
{
@ -110,7 +110,7 @@ namespace TMDbLibTests
[TestMethod]
public void AuthenticationGetUserSessionWithLoginSuccess()
{
UserSession session = _config.Client.AuthenticationGetUserSession(_config.Username, _config.Password).Result;
UserSession session = _config.Client.AuthenticationGetUserSessionAsync(_config.Username, _config.Password).Result;
Assert.IsNotNull(session);
Assert.IsTrue(session.Success);
@ -124,7 +124,7 @@ namespace TMDbLibTests
const string requestToken = "5f3a62c0d7977319e3d14adf1a2064c0c0938bcf";
try
{
_config.Client.AuthenticationGetUserSession(requestToken).Wait();
_config.Client.AuthenticationGetUserSessionAsync(requestToken).Wait();
}
catch (AggregateException ex)
{
@ -138,7 +138,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestAuthenticationCreateGuestSession()
{
GuestSession guestSession = _config.Client.AuthenticationCreateGuestSession().Result;
GuestSession guestSession = _config.Client.AuthenticationCreateGuestSessionAsync().Result;
Assert.IsNotNull(guestSession);
Assert.IsTrue(guestSession.Success);

View File

@ -22,7 +22,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestCertificationsListMovie()
{
CertificationsContainer result = _config.Client.GetMovieCertifications().Result;
CertificationsContainer result = _config.Client.GetMovieCertificationsAsync().Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.Certifications);
Assert.IsTrue(result.Certifications.Count > 1);
@ -42,7 +42,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestCertificationsListTv()
{
CertificationsContainer result = _config.Client.GetTvCertifications().Result;
CertificationsContainer result = _config.Client.GetTvCertificationsAsync().Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.Certifications);
Assert.IsTrue(result.Certifications.Count > 1);

View File

@ -24,7 +24,7 @@ namespace TMDbLibTests
public void TestChangesMovies()
{
// Basic check
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesMovies().Result;
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesMoviesAsync().Result;
Assert.IsNotNull(changesPage1);
Assert.IsTrue(changesPage1.Results.Count > 0);
@ -32,14 +32,14 @@ namespace TMDbLibTests
Assert.AreEqual(1, changesPage1.Page);
// Page 2
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesMovies(2).Result;
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesMoviesAsync(2).Result;
Assert.IsNotNull(changesPage2);
Assert.AreEqual(2, changesPage2.Page);
// Check date range (max)
DateTime higher = DateTime.UtcNow.AddDays(-7);
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesMovies(endDate: higher).Result;
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesMoviesAsync(endDate: higher).Result;
Assert.IsNotNull(changesMaxDate);
Assert.AreEqual(1, changesMaxDate.Page);
@ -47,7 +47,7 @@ namespace TMDbLibTests
// Check date range (lower)
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesMovies(startDate: lower).Result;
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesMoviesAsync(startDate: lower).Result;
Assert.IsNotNull(changesLowDate);
Assert.AreEqual(1, changesLowDate.Page);
@ -58,7 +58,7 @@ namespace TMDbLibTests
public void TestChangesPeople()
{
// Basic check
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesPeople().Result;
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesPeopleAsync().Result;
Assert.IsNotNull(changesPage1);
Assert.IsTrue(changesPage1.Results.Count > 0);
@ -66,14 +66,14 @@ namespace TMDbLibTests
Assert.AreEqual(1, changesPage1.Page);
// Page 2
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesPeople(2).Result;
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesPeopleAsync(2).Result;
Assert.IsNotNull(changesPage2);
Assert.AreEqual(2, changesPage2.Page);
// Check date range (max)
DateTime higher = DateTime.UtcNow.AddDays(-7);
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesPeople(endDate: higher).Result;
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesPeopleAsync(endDate: higher).Result;
Assert.IsNotNull(changesMaxDate);
Assert.AreEqual(1, changesMaxDate.Page);
@ -81,7 +81,7 @@ namespace TMDbLibTests
// Check date range (lower)
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesPeople(startDate: lower).Result;
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesPeopleAsync(startDate: lower).Result;
Assert.IsNotNull(changesLowDate);
Assert.AreEqual(1, changesLowDate.Page);
@ -97,7 +97,7 @@ namespace TMDbLibTests
public void TestChangesTvShows()
{
// Basic check
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesTv().Result;
SearchContainer<ChangesListItem> changesPage1 = _config.Client.GetChangesTvAsync().Result;
Assert.IsNotNull(changesPage1);
Assert.IsNotNull(changesPage1.Results);
@ -109,7 +109,7 @@ namespace TMDbLibTests
{
Assert.IsTrue(changesPage1.TotalResults > changesPage1.Results.Count);
// Page 2
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesTv(2).Result;
SearchContainer<ChangesListItem> changesPage2 = _config.Client.GetChangesTvAsync(2).Result;
Assert.IsNotNull(changesPage2);
Assert.AreEqual(2, changesPage2.Page);
@ -117,7 +117,7 @@ namespace TMDbLibTests
// Check date range (max)
DateTime higher = DateTime.UtcNow.AddDays(-8);
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesTv(endDate: higher).Result;
SearchContainer<ChangesListItem> changesMaxDate = _config.Client.GetChangesTvAsync(endDate: higher).Result;
Assert.IsNotNull(changesMaxDate);
Assert.AreEqual(1, changesMaxDate.Page);
@ -125,7 +125,7 @@ namespace TMDbLibTests
// Check date range (lower)
DateTime lower = DateTime.UtcNow.AddDays(-6); // Use 6 days to avoid clashes with the 'higher'
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesTv(startDate: lower).Result;
SearchContainer<ChangesListItem> changesLowDate = _config.Client.GetChangesTvAsync(startDate: lower).Result;
Assert.IsNotNull(changesLowDate);
Assert.AreEqual(1, changesLowDate.Page);

View File

@ -36,7 +36,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestCollectionsExtrasNone()
{
Collection collection = _config.Client.GetCollection(IdHelper.JamesBondCollection).Result;
Collection collection = _config.Client.GetCollectionAsync(IdHelper.JamesBondCollection).Result;
// TODO: Test all properties
Assert.IsNotNull(collection);
@ -54,14 +54,14 @@ namespace TMDbLibTests
[TestMethod]
public void TestCollectionsExtrasExclusive()
{
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetCollection(id, extras).Result, IdHelper.JamesBondCollection);
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetCollectionAsync(id, extras).Result, IdHelper.JamesBondCollection);
}
[TestMethod]
public void TestCollectionsExtrasAll()
{
CollectionMethods combinedEnum = _methods.Keys.Aggregate((methods, movieMethods) => methods | movieMethods);
Collection item = _config.Client.GetCollection(IdHelper.JamesBondCollection, combinedEnum).Result;
Collection item = _config.Client.GetCollectionAsync(IdHelper.JamesBondCollection, combinedEnum).Result;
TestMethodsHelper.TestAllNotNull(_methods, item);
}
@ -73,7 +73,7 @@ namespace TMDbLibTests
_config.Client.GetConfig();
// Test image url generator
ImagesWithId images = _config.Client.GetCollectionImages(IdHelper.JamesBondCollection).Result;
ImagesWithId images = _config.Client.GetCollectionImagesAsync(IdHelper.JamesBondCollection).Result;
Assert.AreEqual(IdHelper.JamesBondCollection, images.Id);
TestImagesHelpers.TestImages(_config, images);

View File

@ -36,7 +36,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestCompaniesExtrasNone()
{
Company company = _config.Client.GetCompany(IdHelper.TwentiethCenturyFox).Result;
Company company = _config.Client.GetCompanyAsync(IdHelper.TwentiethCenturyFox).Result;
Assert.IsNotNull(company);
@ -53,14 +53,14 @@ namespace TMDbLibTests
[TestMethod]
public void TestCompaniesExtrasExclusive()
{
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetCompany(id, extras).Result, IdHelper.TwentiethCenturyFox);
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetCompanyAsync(id, extras).Result, IdHelper.TwentiethCenturyFox);
}
[TestMethod]
public void TestCompaniesExtrasAll()
{
CompanyMethods combinedEnum = _methods.Keys.Aggregate((methods, movieMethods) => methods | movieMethods);
Company item = _config.Client.GetCompany(IdHelper.TwentiethCenturyFox, combinedEnum).Result;
Company item = _config.Client.GetCompanyAsync(IdHelper.TwentiethCenturyFox, combinedEnum).Result;
TestMethodsHelper.TestAllNotNull(_methods, item);
}
@ -68,10 +68,10 @@ namespace TMDbLibTests
[TestMethod]
public void TestCompaniesGetters()
{
//GetCompanyMovies(int id, string language, int page = -1)
SearchContainerWithId<MovieResult> resp = _config.Client.GetCompanyMovies(IdHelper.TwentiethCenturyFox).Result;
SearchContainerWithId<MovieResult> respPage2 = _config.Client.GetCompanyMovies(IdHelper.TwentiethCenturyFox, 2).Result;
SearchContainerWithId<MovieResult> respItalian = _config.Client.GetCompanyMovies(IdHelper.TwentiethCenturyFox, "it").Result;
//GetCompanyMoviesAsync(int id, string language, int page = -1)
SearchContainerWithId<MovieResult> resp = _config.Client.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox).Result;
SearchContainerWithId<MovieResult> respPage2 = _config.Client.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox, 2).Result;
SearchContainerWithId<MovieResult> respItalian = _config.Client.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox, "it").Result;
Assert.IsNotNull(resp);
Assert.IsNotNull(respPage2);
@ -100,7 +100,7 @@ namespace TMDbLibTests
_config.Client.GetConfig();
// Test image url generator
Company company = _config.Client.GetCompany(IdHelper.TwentiethCenturyFox).Result;
Company company = _config.Client.GetCompanyAsync(IdHelper.TwentiethCenturyFox).Result;
Uri url = _config.Client.GetImageUrl("original", company.LogoPath);
Uri urlSecure = _config.Client.GetImageUrl("original", company.LogoPath, true);
@ -112,7 +112,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestCompaniesFull()
{
Company company = _config.Client.GetCompany(IdHelper.ColumbiaPictures).Result;
Company company = _config.Client.GetCompanyAsync(IdHelper.ColumbiaPictures).Result;
Assert.IsNotNull(company);

View File

@ -23,7 +23,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestGetCreditBase()
{
Credit result = _config.Client.GetCredits(IdHelper.BruceWillisMiamiVice).Result;
Credit result = _config.Client.GetCreditsAsync(IdHelper.BruceWillisMiamiVice).Result;
Assert.IsNotNull(result);
Assert.AreEqual("cast", result.CreditType);
@ -46,7 +46,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestGetCreditEpisode()
{
Credit result = _config.Client.GetCredits(IdHelper.BruceWillisMiamiVice).Result;
Credit result = _config.Client.GetCreditsAsync(IdHelper.BruceWillisMiamiVice).Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.Media);
@ -66,7 +66,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestGetCreditSeasons()
{
Credit result = _config.Client.GetCredits(IdHelper.HughLaurieHouse).Result;
Credit result = _config.Client.GetCreditsAsync(IdHelper.HughLaurieHouse).Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.Media);

View File

@ -24,9 +24,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestDiscoverTvShowsNoParams()
{
TestHelpers.SearchPages(i => _config.Client.DiscoverTvShows().Query(i).Result);
TestHelpers.SearchPages(i => _config.Client.DiscoverTvShowsAsync().Query(i).Result);
SearchContainer<SearchTv> result = _config.Client.DiscoverTvShows().Query().Result;
SearchContainer<SearchTv> result = _config.Client.DiscoverTvShowsAsync().Query().Result;
Assert.IsNotNull(result);
Assert.AreEqual(1, result.Page);
@ -37,7 +37,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestDiscoverTvShows()
{
DiscoverTv query = _config.Client.DiscoverTvShows()
DiscoverTv query = _config.Client.DiscoverTvShowsAsync()
.WhereVoteCountIsAtLeast(100)
.WhereVoteAverageIsAtLeast(2);
@ -47,9 +47,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestDiscoverMoviesNoParams()
{
TestHelpers.SearchPages(i => _config.Client.DiscoverMovies().Query(i).Result);
TestHelpers.SearchPages(i => _config.Client.DiscoverMoviesAsync().Query(i).Result);
SearchContainer<SearchMovie> result = _config.Client.DiscoverMovies().Query().Result;
SearchContainer<SearchMovie> result = _config.Client.DiscoverMoviesAsync().Query().Result;
Assert.IsNotNull(result);
Assert.AreEqual(1, result.Page);
@ -60,7 +60,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestDiscoverMovies()
{
DiscoverMovie query = _config.Client.DiscoverMovies()
DiscoverMovie query = _config.Client.DiscoverMoviesAsync()
.WhereVoteCountIsAtLeast(1000)
.WhereVoteAverageIsAtLeast(2);

View File

@ -21,7 +21,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestFindImdbMovie()
{
var result = _config.Client.Find(FindExternalSource.Imdb, IdHelper.imdbTerminatorId);
var result = _config.Client.FindAsync(FindExternalSource.Imdb, IdHelper.imdbTerminatorId);
Assert.AreEqual(1, result.Result.MovieResults.Count);
Assert.AreEqual(IdHelper.tmdbTerminatorId, result.Result.MovieResults[0].Id);
}
@ -29,7 +29,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestFindTvdbTvShow()
{
var result = _config.Client.Find(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadId);
var result = _config.Client.FindAsync(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadId);
Assert.AreEqual(1, result.Result.TvResults.Count);
Assert.AreEqual(IdHelper.TmdbBreakingBadId, result.Result.TvResults[0].Id);
}
@ -37,7 +37,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestFindImdbTvShow()
{
var result = _config.Client.Find(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadId);
var result = _config.Client.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadId);
Assert.AreEqual(1, result.Result.TvResults.Count);
Assert.AreEqual(IdHelper.TmdbBreakingBadId, result.Result.TvResults[0].Id);
}
@ -45,7 +45,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestFindTvRageTvShow()
{
var result = _config.Client.Find(FindExternalSource.TvRage, IdHelper.TvRageBreakingBadId);
var result = _config.Client.FindAsync(FindExternalSource.TvRage, IdHelper.TvRageBreakingBadId);
Assert.AreEqual(1, result.Result.TvResults.Count);
Assert.AreEqual(IdHelper.TmdbBreakingBadId, result.Result.TvResults[0].Id);
}
@ -53,7 +53,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestFindFreebaseTvShow()
{
var result = _config.Client.Find(FindExternalSource.FreeBaseId, IdHelper.FreebaseBreakingBadId);
var result = _config.Client.FindAsync(FindExternalSource.FreeBaseId, IdHelper.FreebaseBreakingBadId);
Assert.AreEqual(1, result.Result.TvResults.Count);
Assert.AreEqual(IdHelper.TmdbBreakingBadId, result.Result.TvResults[0].Id);
}
@ -61,7 +61,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestFindFreebaseMidTvShow()
{
var result = _config.Client.Find(FindExternalSource.FreeBaseMid, IdHelper.FreebaseMidBreakingBadId);
var result = _config.Client.FindAsync(FindExternalSource.FreeBaseMid, IdHelper.FreebaseMidBreakingBadId);
Assert.AreEqual(1, result.Result.TvResults.Count);
Assert.AreEqual(IdHelper.TmdbBreakingBadId, result.Result.TvResults[0].Id);
}

View File

@ -23,13 +23,13 @@ namespace TMDbLibTests
public void TestGenreTvList()
{
// Default language
List<Genre> genres = _config.Client.GetTvGenres().Result;
List<Genre> genres = _config.Client.GetTvGenresAsync().Result;
Assert.IsNotNull(genres);
Assert.IsTrue(genres.Count > 0);
// Another language
List<Genre> genresDanish = _config.Client.GetTvGenres("da").Result;
List<Genre> genresDanish = _config.Client.GetTvGenresAsync("da").Result;
Assert.IsNotNull(genresDanish);
Assert.IsTrue(genresDanish.Count > 0);
@ -44,13 +44,13 @@ namespace TMDbLibTests
public void TestGenreMovieList()
{
// Default language
List<Genre> genres = _config.Client.GetMovieGenres().Result;
List<Genre> genres = _config.Client.GetMovieGenresAsync().Result;
Assert.IsNotNull(genres);
Assert.IsTrue(genres.Count > 0);
// Another language
List<Genre> genresDanish = _config.Client.GetMovieGenres("da").Result;
List<Genre> genresDanish = _config.Client.GetMovieGenresAsync("da").Result;
Assert.IsNotNull(genresDanish);
Assert.IsTrue(genresDanish.Count > 0);
@ -65,12 +65,12 @@ namespace TMDbLibTests
public void TestGenreMovies()
{
// Get first genre
Genre genre = _config.Client.GetMovieGenres().Result.First();
Genre genre = _config.Client.GetMovieGenresAsync().Result.First();
// Get movies
SearchContainerWithId<MovieResult> movies = _config.Client.GetGenreMovies(genre.Id).Result;
SearchContainerWithId<MovieResult> moviesPage2 = _config.Client.GetGenreMovies(genre.Id, "it", 2, includeAllMovies: false).Result;
SearchContainerWithId<MovieResult> moviesAll = _config.Client.GetGenreMovies(genre.Id, includeAllMovies: true).Result;
SearchContainerWithId<MovieResult> movies = _config.Client.GetGenreMoviesAsync(genre.Id).Result;
SearchContainerWithId<MovieResult> moviesPage2 = _config.Client.GetGenreMoviesAsync(genre.Id, "it", 2, includeAllMovies: false).Result;
SearchContainerWithId<MovieResult> moviesAll = _config.Client.GetGenreMoviesAsync(genre.Id, includeAllMovies: true).Result;
Assert.AreEqual(1, movies.Page);
Assert.AreEqual(2, moviesPage2.Page);

View File

@ -29,34 +29,34 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.GuestTestSessionId, SessionType.GuestSession);
// Try changing the rating
Assert.IsTrue(_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 1, 7.5).Result);
Assert.IsTrue(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 7.5).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
SearchContainer<TvEpisodeWithRating> ratings = _config.Client.GetGuestSessionRatedTvEpisodes().Result;
SearchContainer<TvEpisodeWithRating> ratings = _config.Client.GetGuestSessionRatedTvEpisodesAsync().Result;
Assert.IsTrue(ratings.Results.Any(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1));
Assert.AreEqual(7.5, ratings.Results.Single(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1).Rating, float.Epsilon);
// Try changing it back to the previous rating
Assert.IsTrue(_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 1, 8).Result);
Assert.IsTrue(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 8).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
ratings = _config.Client.GetGuestSessionRatedTvEpisodes().Result;
ratings = _config.Client.GetGuestSessionRatedTvEpisodesAsync().Result;
Assert.IsTrue(ratings.Results.Any(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1));
Assert.AreEqual(8, ratings.Results.Single(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1).Rating, float.Epsilon);
// Try removing the rating
Assert.IsTrue(_config.Client.TvEpisodeRemoveRating(IdHelper.BreakingBad, 1, 1).Result);
Assert.IsTrue(_config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
ratings = _config.Client.GetGuestSessionRatedTvEpisodes().Result;
ratings = _config.Client.GetGuestSessionRatedTvEpisodesAsync().Result;
Assert.IsFalse(ratings.Results.Any(s => s.ShowId == IdHelper.BreakingBad && s.SeasonNumber == 1 && s.EpisodeNumber == 1));
}
@ -67,34 +67,34 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.GuestTestSessionId, SessionType.GuestSession);
// Try changing the rating
Assert.IsTrue(_config.Client.TvShowSetRating(IdHelper.House, 7.5).Result);
Assert.IsTrue(_config.Client.TvShowSetRatingAsync(IdHelper.House, 7.5).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
SearchContainer<TvShowWithRating> ratings = _config.Client.GetGuestSessionRatedTv().Result;
SearchContainer<TvShowWithRating> ratings = _config.Client.GetGuestSessionRatedTvAsync().Result;
Assert.IsTrue(ratings.Results.Any(s => s.Id == IdHelper.House));
Assert.AreEqual(7.5, ratings.Results.Single(s => s.Id == IdHelper.House).Rating, float.Epsilon);
// Try changing it back to the previous rating
Assert.IsTrue(_config.Client.TvShowSetRating(IdHelper.House, 8).Result);
Assert.IsTrue(_config.Client.TvShowSetRatingAsync(IdHelper.House, 8).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
ratings = _config.Client.GetGuestSessionRatedTv().Result;
ratings = _config.Client.GetGuestSessionRatedTvAsync().Result;
Assert.IsTrue(ratings.Results.Any(s => s.Id == IdHelper.House));
Assert.AreEqual(8, ratings.Results.Single(s => s.Id == IdHelper.House).Rating, float.Epsilon);
// Try removing the rating
Assert.IsTrue(_config.Client.TvShowRemoveRating(IdHelper.House).Result);
Assert.IsTrue(_config.Client.TvShowRemoveRatingAsync(IdHelper.House).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
ratings = _config.Client.GetGuestSessionRatedTv().Result;
ratings = _config.Client.GetGuestSessionRatedTvAsync().Result;
Assert.IsFalse(ratings.Results.Any(s => s.Id == IdHelper.House));
}
@ -105,34 +105,34 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.GuestTestSessionId, SessionType.GuestSession);
// Try changing the rating
Assert.IsTrue(_config.Client.MovieSetRating(IdHelper.Avatar, 7.5).Result);
Assert.IsTrue(_config.Client.MovieSetRatingAsync(IdHelper.Avatar, 7.5).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
SearchContainer<MovieWithRating> ratings = _config.Client.GetGuestSessionRatedMovies().Result;
SearchContainer<MovieWithRating> ratings = _config.Client.GetGuestSessionRatedMoviesAsync().Result;
Assert.IsTrue(ratings.Results.Any(s => s.Id == IdHelper.Avatar));
Assert.AreEqual(7.5, ratings.Results.Single(s => s.Id == IdHelper.Avatar).Rating, float.Epsilon);
// Try changing it back to the previous rating
Assert.IsTrue(_config.Client.MovieSetRating(IdHelper.Avatar, 8).Result);
Assert.IsTrue(_config.Client.MovieSetRatingAsync(IdHelper.Avatar, 8).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
ratings = _config.Client.GetGuestSessionRatedMovies().Result;
ratings = _config.Client.GetGuestSessionRatedMoviesAsync().Result;
Assert.IsTrue(ratings.Results.Any(s => s.Id == IdHelper.Avatar));
Assert.AreEqual(8, ratings.Results.Single(s => s.Id == IdHelper.Avatar).Rating, float.Epsilon);
// Try removing the rating
Assert.IsTrue(_config.Client.MovieRemoveRating(IdHelper.Avatar).Result);
Assert.IsTrue(_config.Client.MovieRemoveRatingAsync(IdHelper.Avatar).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
ratings = _config.Client.GetGuestSessionRatedMovies().Result;
ratings = _config.Client.GetGuestSessionRatedMoviesAsync().Result;
Assert.IsFalse(ratings.Results.Any(s => s.Id == IdHelper.Avatar));
}
@ -143,13 +143,13 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.GuestTestSessionId, SessionType.GuestSession);
// Ensure we have a rating
Assert.IsTrue(_config.Client.TvEpisodeSetRating(IdHelper.BigBangTheory, 1, 1, 7.5).Result);
Assert.IsTrue(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 7.5).Result);
// Test paging
TestHelpers.SearchPages(i => _config.Client.GetGuestSessionRatedTvEpisodes(i).Result);
TestHelpers.SearchPages(i => _config.Client.GetGuestSessionRatedTvEpisodesAsync(i).Result);
// Fetch ratings
SearchContainer<TvEpisodeWithRating> result = _config.Client.GetGuestSessionRatedTvEpisodes().Result;
SearchContainer<TvEpisodeWithRating> result = _config.Client.GetGuestSessionRatedTvEpisodesAsync().Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.Results);
@ -161,13 +161,13 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.GuestTestSessionId, SessionType.GuestSession);
// Ensure we have a rating
Assert.IsTrue(_config.Client.TvShowSetRating(IdHelper.BigBangTheory, 7.5).Result);
Assert.IsTrue(_config.Client.TvShowSetRatingAsync(IdHelper.BigBangTheory, 7.5).Result);
// Test paging
TestHelpers.SearchPages(i => _config.Client.GetGuestSessionRatedTv(i).Result);
TestHelpers.SearchPages(i => _config.Client.GetGuestSessionRatedTvAsync(i).Result);
// Fetch ratings
SearchContainer<TvShowWithRating> result = _config.Client.GetGuestSessionRatedTv().Result;
SearchContainer<TvShowWithRating> result = _config.Client.GetGuestSessionRatedTvAsync().Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.Results);
@ -179,13 +179,13 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.GuestTestSessionId, SessionType.GuestSession);
// Ensure we have a rating
Assert.IsTrue(_config.Client.MovieSetRating(IdHelper.Terminator, 7.5).Result);
Assert.IsTrue(_config.Client.MovieSetRatingAsync(IdHelper.Terminator, 7.5).Result);
// Test paging
TestHelpers.SearchPages(i => _config.Client.GetGuestSessionRatedMovies(i).Result);
TestHelpers.SearchPages(i => _config.Client.GetGuestSessionRatedMoviesAsync(i).Result);
// Fetch ratings
SearchContainer<MovieWithRating> result = _config.Client.GetGuestSessionRatedMovies().Result;
SearchContainer<MovieWithRating> result = _config.Client.GetGuestSessionRatedMoviesAsync().Result;
Assert.IsNotNull(result);
Assert.IsNotNull(result.Results);

View File

@ -22,7 +22,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestJobList()
{
List<Job> jobs = _config.Client.GetJobs().Result;
List<Job> jobs = _config.Client.GetJobsAsync().Result;
Assert.IsNotNull(jobs);
Assert.IsTrue(jobs.Count > 0);

View File

@ -23,7 +23,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestKeywordGet()
{
KeywordsContainer keywords = _config.Client.GetMovieKeywords(IdHelper.AGoodDayToDieHard).Result;
KeywordsContainer keywords = _config.Client.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(keywords);
Assert.IsNotNull(keywords.Keywords);
@ -32,7 +32,7 @@ namespace TMDbLibTests
// Try to get all keywords
foreach (Keyword testKeyword in keywords.Keywords)
{
Keyword getKeyword = _config.Client.GetKeyword(testKeyword.Id).Result;
Keyword getKeyword = _config.Client.GetKeywordAsync(testKeyword.Id).Result;
Assert.IsNotNull(getKeyword);
@ -44,7 +44,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestKeywordMovies()
{
KeywordsContainer keywords = _config.Client.GetMovieKeywords(IdHelper.AGoodDayToDieHard).Result;
KeywordsContainer keywords = _config.Client.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(keywords);
Assert.IsNotNull(keywords.Keywords);
@ -54,9 +54,9 @@ namespace TMDbLibTests
Keyword testKeyword = keywords.Keywords.First();
// Get movies
SearchContainer<MovieResult> movies = _config.Client.GetKeywordMovies(testKeyword.Id).Result;
SearchContainer<MovieResult> moviesItalian = _config.Client.GetKeywordMovies(testKeyword.Id, "it").Result;
SearchContainer<MovieResult> moviesPage2 = _config.Client.GetKeywordMovies(testKeyword.Id, 2).Result;
SearchContainer<MovieResult> movies = _config.Client.GetKeywordMoviesAsync(testKeyword.Id).Result;
SearchContainer<MovieResult> moviesItalian = _config.Client.GetKeywordMoviesAsync(testKeyword.Id, "it").Result;
SearchContainer<MovieResult> moviesPage2 = _config.Client.GetKeywordMoviesAsync(testKeyword.Id, 2).Result;
Assert.IsNotNull(movies);
Assert.IsNotNull(moviesItalian);

View File

@ -27,7 +27,7 @@ namespace TMDbLibTests
public void TestList()
{
// Get list
List list = _config.Client.GetList(TestListId).Result;
List list = _config.Client.GetListAsync(TestListId).Result;
Assert.IsNotNull(list);
Assert.AreEqual(TestListId, list.Id);
@ -39,7 +39,7 @@ namespace TMDbLibTests
// Ensure all movies point to this list
int page = 1;
SearchContainer<ListResult> movieLists = _config.Client.GetMovieLists(movieResult.Id).Result;
SearchContainer<ListResult> movieLists = _config.Client.GetMovieListsAsync(movieResult.Id).Result;
while (movieLists != null)
{
// Check if the current result page contains the relevant list
@ -51,7 +51,7 @@ namespace TMDbLibTests
// See if there is an other page we could try, if not the test fails
if (movieLists.Page < movieLists.TotalPages)
movieLists = _config.Client.GetMovieLists(movieResult.Id, ++page).Result;
movieLists = _config.Client.GetMovieListsAsync(movieResult.Id, ++page).Result;
else
Assert.Fail("Movie '{0}' was not linked to the test list", movieResult.Title);
}
@ -61,20 +61,20 @@ namespace TMDbLibTests
[TestMethod]
public void TestListIsMoviePresentFailure()
{
Assert.IsFalse(_config.Client.GetListIsMoviePresent(TestListId, IdHelper.Terminator).Result);
Assert.IsFalse(_config.Client.GetListIsMoviePresentAsync(TestListId, IdHelper.Terminator).Result);
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Clear list
Assert.IsTrue(_config.Client.ListClear(TestListId).Result);
Assert.IsTrue(_config.Client.ListClearAsync(TestListId).Result);
// Verify Avatar is not present
Assert.IsFalse(_config.Client.GetListIsMoviePresent(TestListId, IdHelper.Avatar).Result);
Assert.IsFalse(_config.Client.GetListIsMoviePresentAsync(TestListId, IdHelper.Avatar).Result);
// Add Avatar
Assert.IsTrue(_config.Client.ListAddMovie(TestListId, IdHelper.Avatar).Result);
Assert.IsTrue(_config.Client.ListAddMovieAsync(TestListId, IdHelper.Avatar).Result);
// Verify Avatar is present
Assert.IsTrue(_config.Client.GetListIsMoviePresent(TestListId, IdHelper.Avatar).Result);
Assert.IsTrue(_config.Client.GetListIsMoviePresentAsync(TestListId, IdHelper.Avatar).Result);
}
[TestMethod]
@ -83,11 +83,11 @@ namespace TMDbLibTests
const string listName = "Test List 123";
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
string newListId = _config.Client.ListCreate(listName).Result;
string newListId = _config.Client.ListCreateAsync(listName).Result;
Assert.IsFalse(string.IsNullOrWhiteSpace(newListId));
List newlyAddedList = _config.Client.GetList(newListId).Result;
List newlyAddedList = _config.Client.GetListAsync(newListId).Result;
Assert.IsNotNull(newlyAddedList);
Assert.AreEqual(listName, newlyAddedList.Name);
Assert.AreEqual("", newlyAddedList.Description); // "" is the default value
@ -96,7 +96,7 @@ namespace TMDbLibTests
Assert.AreEqual(0, newlyAddedList.Items.Count);
Assert.IsFalse(string.IsNullOrWhiteSpace(newlyAddedList.CreatedBy));
Assert.IsTrue(_config.Client.ListDelete(newListId).Result);
Assert.IsTrue(_config.Client.ListDeleteAsync(newListId).Result);
}
[TestMethod]
@ -105,7 +105,7 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Try removing a list with an incorrect id
Assert.IsFalse(_config.Client.ListDelete("bla").Result);
Assert.IsFalse(_config.Client.ListDeleteAsync("bla").Result);
}
[TestMethod]
@ -114,20 +114,20 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Add a new movie to the list
Assert.IsTrue(_config.Client.ListAddMovie(TestListId, IdHelper.EvanAlmighty).Result);
Assert.IsTrue(_config.Client.ListAddMovieAsync(TestListId, IdHelper.EvanAlmighty).Result);
// Try again, this time it should fail since the list already contains this movie
Assert.IsFalse(_config.Client.ListAddMovie(TestListId, IdHelper.EvanAlmighty).Result);
Assert.IsFalse(_config.Client.ListAddMovieAsync(TestListId, IdHelper.EvanAlmighty).Result);
// Get list and check if the item was added
List listAfterAdd = _config.Client.GetList(TestListId).Result;
List listAfterAdd = _config.Client.GetListAsync(TestListId).Result;
Assert.IsTrue(listAfterAdd.Items.Any(m => m.Id == IdHelper.EvanAlmighty));
// Remove the previously added movie from the list
Assert.IsTrue(_config.Client.ListRemoveMovie(TestListId, IdHelper.EvanAlmighty).Result);
Assert.IsTrue(_config.Client.ListRemoveMovieAsync(TestListId, IdHelper.EvanAlmighty).Result);
// Get list and check if the item was removed
List listAfterRemove = _config.Client.GetList(TestListId).Result;
List listAfterRemove = _config.Client.GetListAsync(TestListId).Result;
Assert.IsFalse(listAfterRemove.Items.Any(m => m.Id == IdHelper.EvanAlmighty));
}
@ -137,17 +137,17 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Add a new movie to the list
Assert.IsTrue(_config.Client.ListAddMovie(TestListId, IdHelper.MadMaxFuryRoad).Result);
Assert.IsTrue(_config.Client.ListAddMovieAsync(TestListId, IdHelper.MadMaxFuryRoad).Result);
// Get list and check if the item was added
List listAfterAdd = _config.Client.GetList(TestListId).Result;
List listAfterAdd = _config.Client.GetListAsync(TestListId).Result;
Assert.IsTrue(listAfterAdd.Items.Any(m => m.Id == IdHelper.MadMaxFuryRoad));
// Clear the list
Assert.IsTrue(_config.Client.ListClear(TestListId).Result);
Assert.IsTrue(_config.Client.ListClearAsync(TestListId).Result);
// Get list and check that all items were removed
List listAfterRemove = _config.Client.GetList(TestListId).Result;
List listAfterRemove = _config.Client.GetListAsync(TestListId).Result;
Assert.IsFalse(listAfterRemove.Items.Any());
}
}

View File

@ -54,7 +54,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesExtrasNone()
{
Movie movie = _config.Client.GetMovie(IdHelper.AGoodDayToDieHard).Result;
Movie movie = _config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(movie);
@ -72,7 +72,7 @@ namespace TMDbLibTests
public void TestMoviesExtrasExclusive()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetMovie(id, extras).Result, IdHelper.AGoodDayToDieHard);
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetMovieAsync(id, extras).Result, IdHelper.AGoodDayToDieHard);
}
[TestMethod]
@ -84,10 +84,10 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Account states will only show up if we've done something
_config.Client.MovieSetRating(IdHelper.TheDarkKnightRises, 5).Wait();
_config.Client.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5).Wait();
MovieMethods combinedEnum = tmpMethods.Keys.Aggregate((methods, movieMethods) => methods | movieMethods);
Movie item = _config.Client.GetMovie(IdHelper.TheDarkKnightRises, combinedEnum).Result;
Movie item = _config.Client.GetMovieAsync(IdHelper.TheDarkKnightRises, combinedEnum).Result;
TestMethodsHelper.TestAllNotNull(tmpMethods, item);
}
@ -97,7 +97,7 @@ namespace TMDbLibTests
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
MovieMethods combinedEnum = _methods.Keys.Aggregate((methods, movieMethods) => methods | movieMethods);
Movie item = _config.Client.GetMovie(IdHelper.AGoodDayToDieHard, combinedEnum).Result;
Movie item = _config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard, combinedEnum).Result;
TestMethodsHelper.TestAllNotNull(_methods, item);
}
@ -105,8 +105,8 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesLanguage()
{
Movie movie = _config.Client.GetMovie(IdHelper.AGoodDayToDieHard).Result;
Movie movieItalian = _config.Client.GetMovie(IdHelper.AGoodDayToDieHard, "it").Result;
Movie movie = _config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard).Result;
Movie movieItalian = _config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard, "it").Result;
Assert.IsNotNull(movie);
Assert.IsNotNull(movieItalian);
@ -125,11 +125,11 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieAlternativeTitles()
{
//GetMovieAlternativeTitles(int id, string country)
AlternativeTitles respUs = _config.Client.GetMovieAlternativeTitles(IdHelper.AGoodDayToDieHard, "US").Result;
//GetMovieAlternativeTitlesAsync(int id, string country)
AlternativeTitles respUs = _config.Client.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "US").Result;
Assert.IsNotNull(respUs);
AlternativeTitles respFrench = _config.Client.GetMovieAlternativeTitles(IdHelper.AGoodDayToDieHard, "FR").Result;
AlternativeTitles respFrench = _config.Client.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "FR").Result;
Assert.IsNotNull(respFrench);
Assert.IsFalse(respUs.Titles.Any(s => s.Title == "Duro de matar 5"));
@ -142,7 +142,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieReleaseDates()
{
ResultContainer<ReleaseDatesContainer> resp = _config.Client.GetMovieReleaseDates(IdHelper.AGoodDayToDieHard).Result;
ResultContainer<ReleaseDatesContainer> resp = _config.Client.GetMovieReleaseDatesAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(resp);
ReleaseDatesContainer releasesUs = resp.Results.SingleOrDefault(s => s.Iso_3166_1 == "US");
@ -161,12 +161,12 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieAlternativeTitlesCountry()
{
AlternativeTitles respUs = _config.Client.GetMovieAlternativeTitles(IdHelper.AGoodDayToDieHard, "US").Result;
AlternativeTitles respUs = _config.Client.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "US").Result;
Assert.IsNotNull(respUs);
_config.Client.DefaultCountry = "US";
AlternativeTitles respUs2 = _config.Client.GetMovieAlternativeTitles(IdHelper.AGoodDayToDieHard).Result;
AlternativeTitles respUs2 = _config.Client.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(respUs2);
Assert.AreEqual(respUs.Titles.Count, respUs2.Titles.Count);
@ -175,7 +175,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieCasts()
{
Credits resp = _config.Client.GetMovieCredits(IdHelper.AGoodDayToDieHard).Result;
Credits resp = _config.Client.GetMovieCreditsAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(resp);
Cast cast = resp.Cast.SingleOrDefault(s => s.Name == "Bruce Willis");
@ -204,7 +204,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieImages()
{
ImagesWithId resp = _config.Client.GetMovieImages(IdHelper.AGoodDayToDieHard).Result;
ImagesWithId resp = _config.Client.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(resp);
ImageData backdrop = resp.Backdrops.SingleOrDefault(s => s.FilePath == "/17zArExB7ztm6fjUXZwQWgGMC9f.jpg");
@ -233,7 +233,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieKeywords()
{
KeywordsContainer resp = _config.Client.GetMovieKeywords(IdHelper.AGoodDayToDieHard).Result;
KeywordsContainer resp = _config.Client.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(resp);
Keyword keyword = resp.Keywords.SingleOrDefault(s => s.Id == 186447);
@ -246,7 +246,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieReleases()
{
Releases resp = _config.Client.GetMovieReleases(IdHelper.AGoodDayToDieHard).Result;
Releases resp = _config.Client.GetMovieReleasesAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(resp);
Country country = resp.Countries.SingleOrDefault(s => s.Iso_3166_1 == "US");
@ -261,7 +261,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieVideos()
{
ResultContainer<Video> resp = _config.Client.GetMovieVideos(IdHelper.AGoodDayToDieHard).Result;
ResultContainer<Video> resp = _config.Client.GetMovieVideosAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(resp);
Assert.IsNotNull(resp);
@ -282,7 +282,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieTranslations()
{
TranslationsContainer resp = _config.Client.GetMovieTranslations(IdHelper.AGoodDayToDieHard).Result;
TranslationsContainer resp = _config.Client.GetMovieTranslationsAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(resp);
Translation translation = resp.Translations.SingleOrDefault(s => s.EnglishName == "German");
@ -296,10 +296,10 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieSimilarMovies()
{
SearchContainer<MovieResult> resp = _config.Client.GetMovieSimilar(IdHelper.AGoodDayToDieHard).Result;
SearchContainer<MovieResult> resp = _config.Client.GetMovieSimilarAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(resp);
SearchContainer<MovieResult> respGerman = _config.Client.GetMovieSimilar(IdHelper.AGoodDayToDieHard, language: "de").Result;
SearchContainer<MovieResult> respGerman = _config.Client.GetMovieSimilarAsync(IdHelper.AGoodDayToDieHard, language: "de").Result;
Assert.IsNotNull(respGerman);
Assert.AreEqual(resp.Results.Count, respGerman.Results.Count);
@ -319,7 +319,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieReviews()
{
SearchContainer<Review> resp = _config.Client.GetMovieReviews(IdHelper.TheDarkKnightRises).Result;
SearchContainer<Review> resp = _config.Client.GetMovieReviewsAsync(IdHelper.TheDarkKnightRises).Result;
Assert.IsNotNull(resp);
Assert.AreNotEqual(0, resp.Results.Count);
@ -329,11 +329,11 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieLists()
{
//GetMovieLists(int id, string language, int page = -1)
SearchContainer<ListResult> resp = _config.Client.GetMovieLists(IdHelper.AGoodDayToDieHard).Result;
//GetMovieListsAsync(int id, string language, int page = -1)
SearchContainer<ListResult> resp = _config.Client.GetMovieListsAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(resp);
SearchContainer<ListResult> respPage2 = _config.Client.GetMovieLists(IdHelper.AGoodDayToDieHard, 2).Result;
SearchContainer<ListResult> respPage2 = _config.Client.GetMovieListsAsync(IdHelper.AGoodDayToDieHard, 2).Result;
Assert.IsNotNull(respPage2);
Assert.AreEqual(1, resp.Page);
@ -344,14 +344,14 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGetMovieChanges()
{
//GetMovieChanges(int id, DateTime? startDate = null, DateTime? endDate = null)
// Find latest changed title
int latestChanged = _config.Client.GetMovieLatest().Result.Id;
//GetMovieChangesAsync(int id, DateTime? startDate = null, DateTime? endDate = null)
// FindAsync latest changed title
int latestChanged = _config.Client.GetMovieLatestAsync().Result.Id;
// Fetch changelog
DateTime lower = DateTime.UtcNow.AddDays(-13);
DateTime higher = DateTime.UtcNow.AddDays(1);
List<Change> respRange = _config.Client.GetMovieChanges(latestChanged, lower, higher).Result;
List<Change> respRange = _config.Client.GetMovieChangesAsync(latestChanged, lower, higher).Result;
Assert.IsNotNull(respRange);
Assert.IsTrue(respRange.Count > 0);
@ -376,7 +376,7 @@ namespace TMDbLibTests
_config.Client.GetConfig();
// Test image url generator
ImagesWithId images = _config.Client.GetMovieImages(IdHelper.AGoodDayToDieHard).Result;
ImagesWithId images = _config.Client.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.AreEqual(IdHelper.AGoodDayToDieHard, images.Id);
TestImagesHelpers.TestImages(_config, images);
@ -385,22 +385,22 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesList()
{
//GetMovieList(MovieListType type, string language, int page = -1)
//GetMovieListAsync(MovieListType type, string language, int page = -1)
foreach (MovieListType type in Enum.GetValues(typeof(MovieListType)).OfType<MovieListType>())
{
SearchContainer<MovieResult> list = _config.Client.GetMovieList(type).Result;
SearchContainer<MovieResult> list = _config.Client.GetMovieListAsync(type).Result;
Assert.IsNotNull(list);
Assert.IsTrue(list.Results.Count > 0);
Assert.AreEqual(1, list.Page);
SearchContainer<MovieResult> listPage2 = _config.Client.GetMovieList(type, 2).Result;
SearchContainer<MovieResult> listPage2 = _config.Client.GetMovieListAsync(type, 2).Result;
Assert.IsNotNull(listPage2);
Assert.IsTrue(listPage2.Results.Count > 0);
Assert.AreEqual(2, listPage2.Page);
SearchContainer<MovieResult> listDe = _config.Client.GetMovieList(type, "de").Result;
SearchContainer<MovieResult> listDe = _config.Client.GetMovieListAsync(type, "de").Result;
Assert.IsNotNull(listDe);
Assert.IsTrue(listDe.Results.Count > 0);
@ -415,29 +415,29 @@ namespace TMDbLibTests
public void TestMoviesAccountStateFavoriteSet()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
AccountState accountState = _config.Client.GetMovieAccountState(IdHelper.MadMaxFuryRoad).Result;
AccountState accountState = _config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad).Result;
// Remove the favourite
if (accountState.Favorite)
_config.Client.AccountChangeFavoriteStatus(MediaType.Movie, IdHelper.MadMaxFuryRoad, false).Wait();
_config.Client.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie is NOT favourited
accountState = _config.Client.GetMovieAccountState(IdHelper.MadMaxFuryRoad).Result;
accountState = _config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad).Result;
Assert.AreEqual(IdHelper.MadMaxFuryRoad, accountState.Id);
Assert.IsFalse(accountState.Favorite);
// Favourite the movie
_config.Client.AccountChangeFavoriteStatus(MediaType.Movie, IdHelper.MadMaxFuryRoad, true).Wait();
_config.Client.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie IS favourited
accountState = _config.Client.GetMovieAccountState(IdHelper.MadMaxFuryRoad).Result;
accountState = _config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad).Result;
Assert.AreEqual(IdHelper.MadMaxFuryRoad, accountState.Id);
Assert.IsTrue(accountState.Favorite);
}
@ -446,29 +446,29 @@ namespace TMDbLibTests
public void TestMoviesAccountStateWatchlistSet()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
AccountState accountState = _config.Client.GetMovieAccountState(IdHelper.MadMaxFuryRoad).Result;
AccountState accountState = _config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad).Result;
// Remove the watchlist
if (accountState.Watchlist)
_config.Client.AccountChangeWatchlistStatus(MediaType.Movie, IdHelper.MadMaxFuryRoad, false).Wait();
_config.Client.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie is NOT watchlisted
accountState = _config.Client.GetMovieAccountState(IdHelper.MadMaxFuryRoad).Result;
accountState = _config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad).Result;
Assert.AreEqual(IdHelper.MadMaxFuryRoad, accountState.Id);
Assert.IsFalse(accountState.Watchlist);
// Watchlist the movie
_config.Client.AccountChangeWatchlistStatus(MediaType.Movie, IdHelper.MadMaxFuryRoad, true).Wait();
_config.Client.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie IS watchlisted
accountState = _config.Client.GetMovieAccountState(IdHelper.MadMaxFuryRoad).Result;
accountState = _config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad).Result;
Assert.AreEqual(IdHelper.MadMaxFuryRoad, accountState.Id);
Assert.IsTrue(accountState.Watchlist);
}
@ -477,57 +477,57 @@ namespace TMDbLibTests
public void TestMoviesAccountStateRatingSet()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
AccountState accountState = _config.Client.GetMovieAccountState(IdHelper.MadMaxFuryRoad).Result;
AccountState accountState = _config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad).Result;
// Remove the rating
if (accountState.Rating.HasValue)
{
Assert.IsTrue(_config.Client.MovieRemoveRating(IdHelper.MadMaxFuryRoad).Result);
Assert.IsTrue(_config.Client.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
}
// Test that the movie is NOT rated
accountState = _config.Client.GetMovieAccountState(IdHelper.MadMaxFuryRoad).Result;
accountState = _config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad).Result;
Assert.AreEqual(IdHelper.MadMaxFuryRoad, accountState.Id);
Assert.IsFalse(accountState.Rating.HasValue);
// Rate the movie
_config.Client.MovieSetRating(IdHelper.MadMaxFuryRoad, 5).Wait();
_config.Client.MovieSetRatingAsync(IdHelper.MadMaxFuryRoad, 5).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie IS rated
accountState = _config.Client.GetMovieAccountState(IdHelper.MadMaxFuryRoad).Result;
accountState = _config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad).Result;
Assert.AreEqual(IdHelper.MadMaxFuryRoad, accountState.Id);
Assert.IsTrue(accountState.Rating.HasValue);
// Remove the rating
Assert.IsTrue(_config.Client.MovieRemoveRating(IdHelper.MadMaxFuryRoad).Result);
Assert.IsTrue(_config.Client.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad).Result);
}
[TestMethod]
public void TestMoviesSetRatingBadRating()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
Assert.IsFalse(_config.Client.MovieSetRating(IdHelper.Avatar, 7.1).Result);
Assert.IsFalse(_config.Client.MovieSetRatingAsync(IdHelper.Avatar, 7.1).Result);
}
[TestMethod]
public void TestMoviesSetRatingRatingOutOfBounds()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
Assert.IsFalse(_config.Client.MovieSetRating(IdHelper.Avatar, 10.5).Result);
Assert.IsFalse(_config.Client.MovieSetRatingAsync(IdHelper.Avatar, 10.5).Result);
}
[TestMethod]
public void TestMoviesSetRatingRatingLowerBoundsTest()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
Assert.IsFalse(_config.Client.MovieSetRating(IdHelper.Avatar, 0).Result);
Assert.IsFalse(_config.Client.MovieSetRatingAsync(IdHelper.Avatar, 0).Result);
}
[TestMethod]
@ -536,35 +536,35 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Ensure that the test movie has a different rating than our test rating
var rating = _config.Client.GetMovieAccountState(IdHelper.Avatar).Result.Rating;
var rating = _config.Client.GetMovieAccountStateAsync(IdHelper.Avatar).Result.Rating;
Assert.IsNotNull(rating);
double originalRating = rating.Value;
double newRating = Math.Abs(originalRating - 7.5) < double.Epsilon ? 2.5 : 7.5;
// Try changing the rating
Assert.IsTrue(_config.Client.MovieSetRating(IdHelper.Avatar, newRating).Result);
Assert.IsTrue(_config.Client.MovieSetRatingAsync(IdHelper.Avatar, newRating).Result);
// Allow TMDb to not cache our data
Thread.Sleep(2000);
// Check if it worked
Assert.AreEqual(newRating, _config.Client.GetMovieAccountState(IdHelper.Avatar).Result.Rating);
Assert.AreEqual(newRating, _config.Client.GetMovieAccountStateAsync(IdHelper.Avatar).Result.Rating);
// Try changing it back to the previous rating
Assert.IsTrue(_config.Client.MovieSetRating(IdHelper.Avatar, originalRating).Result);
Assert.IsTrue(_config.Client.MovieSetRatingAsync(IdHelper.Avatar, originalRating).Result);
// Allow TMDb to not cache our data
Thread.Sleep(2000);
// Check if it worked
Assert.AreEqual(originalRating, _config.Client.GetMovieAccountState(IdHelper.Avatar).Result.Rating);
Assert.AreEqual(originalRating, _config.Client.GetMovieAccountStateAsync(IdHelper.Avatar).Result.Rating);
}
[TestMethod]
public void TestMoviesGetHtmlEncodedText()
{
Movie item = _config.Client.GetMovie(IdHelper.Furious7, "de").Result;
Movie item = _config.Client.GetMovieAsync(IdHelper.Furious7, "de").Result;
Assert.IsNotNull(item);
@ -574,7 +574,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestMoviesGet()
{
Movie item = _config.Client.GetMovie(IdHelper.AGoodDayToDieHard).Result;
Movie item = _config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard).Result;
Assert.IsNotNull(item);
Assert.AreEqual(IdHelper.AGoodDayToDieHard, item.Id);
@ -626,15 +626,15 @@ namespace TMDbLibTests
// Test the custom parsing code for Account State rating
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
Movie movie = _config.Client.GetMovie(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates).Result;
Movie movie = _config.Client.GetMovieAsync(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates).Result;
if (movie.AccountStates == null || !movie.AccountStates.Rating.HasValue)
{
_config.Client.MovieSetRating(IdHelper.TheDarkKnightRises, 5).Wait();
_config.Client.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5).Wait();
// Allow TMDb to update cache
Thread.Sleep(2000);
movie = _config.Client.GetMovie(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates).Result;
movie = _config.Client.GetMovieAsync(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates).Result;
}
Assert.IsNotNull(movie.AccountStates);

View File

@ -21,7 +21,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestNetworkGetById()
{
Network network = _config.Client.GetNetwork(IdHelper.Hbo).Result;
Network network = _config.Client.GetNetworkAsync(IdHelper.Hbo).Result;
Assert.IsNotNull(network);
Assert.AreEqual("HBO", network.Name);

View File

@ -42,7 +42,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestPersonsExtrasNone()
{
Person person = _config.Client.GetPerson(IdHelper.BruceWillis).Result;
Person person = _config.Client.GetPersonAsync(IdHelper.BruceWillis).Result;
Assert.IsNotNull(person);
@ -58,14 +58,14 @@ namespace TMDbLibTests
[TestMethod]
public void TestPersonsExtrasExclusive()
{
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetPerson(id, extras).Result, IdHelper.BruceWillis);
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetPersonAsync(id, extras).Result, IdHelper.BruceWillis);
}
[TestMethod]
public void TestPersonsExtrasAll()
{
PersonMethods combinedEnum = _methods.Keys.Aggregate((methods, movieMethods) => methods | movieMethods);
Person item = _config.Client.GetPerson(IdHelper.BruceWillis, combinedEnum).Result;
Person item = _config.Client.GetPersonAsync(IdHelper.BruceWillis, combinedEnum).Result;
TestMethodsHelper.TestAllNotNull(_methods, item);
}
@ -73,7 +73,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestPersonsGet()
{
Person item = _config.Client.GetPerson(IdHelper.BruceWillis).Result;
Person item = _config.Client.GetPersonAsync(IdHelper.BruceWillis).Result;
Assert.IsNotNull(item);
Assert.AreEqual(false, item.Adult);
@ -96,7 +96,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestPersonsGetPersonTvCredits()
{
TvCredits item = _config.Client.GetPersonTvCredits(IdHelper.BruceWillis).Result;
TvCredits item = _config.Client.GetPersonTvCreditsAsync(IdHelper.BruceWillis).Result;
Assert.IsNotNull(item);
Assert.IsNotNull(item.Cast);
@ -131,7 +131,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestPersonsGetPersonMovieCredits()
{
MovieCredits item = _config.Client.GetPersonMovieCredits(IdHelper.BruceWillis).Result;
MovieCredits item = _config.Client.GetPersonMovieCreditsAsync(IdHelper.BruceWillis).Result;
Assert.IsNotNull(item);
Assert.IsNotNull(item.Cast);
@ -166,7 +166,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestPersonsGetPersonExternalIds()
{
ExternalIds item = _config.Client.GetPersonExternalIds(IdHelper.BruceWillis).Result;
ExternalIds item = _config.Client.GetPersonExternalIdsAsync(IdHelper.BruceWillis).Result;
Assert.IsNotNull(item);
@ -182,10 +182,10 @@ namespace TMDbLibTests
public void TestPersonsGetPersonCredits()
{
//GetPersonCredits(int id, string language)
MovieCredits resp = _config.Client.GetPersonMovieCredits(IdHelper.BruceWillis).Result;
MovieCredits resp = _config.Client.GetPersonMovieCreditsAsync(IdHelper.BruceWillis).Result;
Assert.IsNotNull(resp);
MovieCredits respItalian = _config.Client.GetPersonMovieCredits(IdHelper.BruceWillis, "it").Result;
MovieCredits respItalian = _config.Client.GetPersonMovieCreditsAsync(IdHelper.BruceWillis, "it").Result;
Assert.IsNotNull(respItalian);
Assert.AreEqual(resp.Cast.Count, respItalian.Cast.Count);
@ -218,14 +218,14 @@ namespace TMDbLibTests
[TestMethod]
public void TestPersonsGetPersonChanges()
{
//GetPersonChanges(int id, DateTime? startDate = null, DateTime? endDate = null)
// Find latest changed person
int latestChanged = _config.Client.GetChangesPeople().Result.Results.First().Id;
//GetPersonChangesAsync(int id, DateTime? startDate = null, DateTime? endDate = null)
// FindAsync latest changed person
int latestChanged = _config.Client.GetChangesPeopleAsync().Result.Results.First().Id;
// Fetch changelog
DateTime lower = DateTime.UtcNow.AddDays(-14);
DateTime higher = DateTime.UtcNow;
List<Change> respRange = _config.Client.GetPersonChanges(latestChanged, lower, higher).Result;
List<Change> respRange = _config.Client.GetPersonChangesAsync(latestChanged, lower, higher).Result;
Assert.IsNotNull(respRange);
Assert.IsTrue(respRange.Count > 0);
@ -250,7 +250,7 @@ namespace TMDbLibTests
_config.Client.GetConfig();
// Get images
ProfileImages images = _config.Client.GetPersonImages(IdHelper.BruceWillis).Result;
ProfileImages images = _config.Client.GetPersonImagesAsync(IdHelper.BruceWillis).Result;
Assert.IsNotNull(images);
Assert.IsNotNull(images.Profiles);
@ -278,9 +278,9 @@ namespace TMDbLibTests
_config.Client.GetConfig();
// Get images
TestHelpers.SearchPages(i => _config.Client.GetPersonTaggedImages(IdHelper.BruceWillis, i).Result);
TestHelpers.SearchPages(i => _config.Client.GetPersonTaggedImagesAsync(IdHelper.BruceWillis, i).Result);
SearchContainer<TaggedImage> images = _config.Client.GetPersonTaggedImages(IdHelper.BruceWillis, 1).Result;
SearchContainer<TaggedImage> images = _config.Client.GetPersonTaggedImagesAsync(IdHelper.BruceWillis, 1).Result;
Assert.IsNotNull(images);
Assert.IsNotNull(images.Results);
@ -326,19 +326,19 @@ namespace TMDbLibTests
{
foreach (PersonListType type in Enum.GetValues(typeof(PersonListType)).OfType<PersonListType>())
{
SearchContainer<PersonResult> list = _config.Client.GetPersonList(type).Result;
SearchContainer<PersonResult> list = _config.Client.GetPersonListAsync(type).Result;
Assert.IsNotNull(list);
Assert.IsTrue(list.Results.Count > 0);
Assert.AreEqual(1, list.Page);
SearchContainer<PersonResult> listPage2 = _config.Client.GetPersonList(type, 2).Result;
SearchContainer<PersonResult> listPage2 = _config.Client.GetPersonListAsync(type, 2).Result;
Assert.IsNotNull(listPage2);
Assert.IsTrue(listPage2.Results.Count > 0);
Assert.AreEqual(2, listPage2.Page);
SearchContainer<PersonResult> list2 = _config.Client.GetPersonList(type).Result;
SearchContainer<PersonResult> list2 = _config.Client.GetPersonListAsync(type).Result;
Assert.IsNotNull(list2);
Assert.IsTrue(list2.Results.Count > 0);
@ -352,7 +352,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestGetLatestPerson()
{
Person item = _config.Client.GetLatestPerson().Result;
Person item = _config.Client.GetLatestPersonAsync().Result;
Assert.IsNotNull(item);
}
}

View File

@ -22,7 +22,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestReviewFullDetails()
{
Review review = _config.Client.GetReview(IdHelper.TheDarkKnightRisesReviewId).Result;
Review review = _config.Client.GetReviewAsync(IdHelper.TheDarkKnightRisesReviewId).Result;
Assert.IsNotNull(review);

View File

@ -24,11 +24,11 @@ namespace TMDbLibTests
[TestMethod]
public void TestSearchMovie()
{
TestHelpers.SearchPages(i => _config.Client.SearchMovie("007", i).Result);
TestHelpers.SearchPages(i => _config.Client.SearchMovieAsync("007", i).Result);
// Search pr. Year
// 1962: First James Bond movie, "Dr. No"
SearchContainer<SearchMovie> result = _config.Client.SearchMovie("007", year: 1962).Result;
SearchContainer<SearchMovie> result = _config.Client.SearchMovieAsync("007", year: 1962).Result;
Assert.IsTrue(result.Results.Any());
SearchMovie item = result.Results.SingleOrDefault(s => s.Id == 646);
@ -57,9 +57,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestSearchCollection()
{
TestHelpers.SearchPages(i => _config.Client.SearchCollection("007", i).Result);
TestHelpers.SearchPages(i => _config.Client.SearchCollectionAsync("007", i).Result);
SearchContainer<SearchResultCollection> result = _config.Client.SearchCollection("James Bond").Result;
SearchContainer<SearchResultCollection> result = _config.Client.SearchCollectionAsync("James Bond").Result;
Assert.IsTrue(result.Results.Any());
SearchResultCollection item = result.Results.SingleOrDefault(s => s.Id == 645);
@ -74,9 +74,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestSearchPerson()
{
TestHelpers.SearchPages(i => _config.Client.SearchPerson("Willis", i).Result);
TestHelpers.SearchPages(i => _config.Client.SearchPersonAsync("Willis", i).Result);
SearchContainer<SearchPerson> result = _config.Client.SearchPerson("Willis").Result;
SearchContainer<SearchPerson> result = _config.Client.SearchPersonAsync("Willis").Result;
Assert.IsTrue(result.Results.Any());
SearchPerson item = result.Results.SingleOrDefault(s => s.Id == 62);
@ -95,9 +95,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestSearchList()
{
TestHelpers.SearchPages(i => _config.Client.SearchList("to watch", i).Result);
TestHelpers.SearchPages(i => _config.Client.SearchListAsync("to watch", i).Result);
SearchContainer<SearchList> result = _config.Client.SearchList("to watch").Result;
SearchContainer<SearchList> result = _config.Client.SearchListAsync("to watch").Result;
Assert.IsTrue(result.Results.Any());
SearchList item = result.Results.SingleOrDefault(s => s.Id == "54a5c0ceaed56c28c300013a");
@ -116,9 +116,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestSearchCompany()
{
TestHelpers.SearchPages(i => _config.Client.SearchCompany("20th", i).Result);
TestHelpers.SearchPages(i => _config.Client.SearchCompanyAsync("20th", i).Result);
SearchContainer<SearchCompany> result = _config.Client.SearchCompany("20th").Result;
SearchContainer<SearchCompany> result = _config.Client.SearchCompanyAsync("20th").Result;
Assert.IsTrue(result.Results.Any());
SearchCompany item = result.Results.SingleOrDefault(s => s.Id == 25);
@ -132,9 +132,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestSearchKeyword()
{
TestHelpers.SearchPages(i => _config.Client.SearchKeyword("plot", i).Result);
TestHelpers.SearchPages(i => _config.Client.SearchKeywordAsync("plot", i).Result);
SearchContainer<SearchKeyword> result = _config.Client.SearchKeyword("plot").Result;
SearchContainer<SearchKeyword> result = _config.Client.SearchKeywordAsync("plot").Result;
Assert.IsTrue(result.Results.Any());
SearchKeyword item = result.Results.SingleOrDefault(s => s.Id == 11121);
@ -147,9 +147,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestSearchTvShow()
{
TestHelpers.SearchPages(i => _config.Client.SearchTvShow("Breaking Bad", i).Result);
TestHelpers.SearchPages(i => _config.Client.SearchTvShowAsync("Breaking Bad", i).Result);
SearchContainer<SearchTv> result = _config.Client.SearchTvShow("Breaking Bad").Result;
SearchContainer<SearchTv> result = _config.Client.SearchTvShowAsync("Breaking Bad").Result;
Assert.IsTrue(result.Results.Any());
SearchTv item = result.Results.SingleOrDefault(s => s.Id == 1396);
@ -179,9 +179,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestSearchMulti()
{
TestHelpers.SearchPages(i => _config.Client.SearchMulti("Arrow", i).Result);
TestHelpers.SearchPages(i => _config.Client.SearchMultiAsync("Arrow", i).Result);
SearchContainer<SearchMulti> result = _config.Client.SearchMulti("Arrow").Result;
SearchContainer<SearchMulti> result = _config.Client.SearchMultiAsync("Arrow").Result;
Assert.IsTrue(result.Results.Any());
SearchMulti item = result.Results.SingleOrDefault(s => s.Id == 1412);

View File

@ -113,7 +113,7 @@ namespace TMDbLibTests
{
try
{
client.GetMovie(id).Wait();
client.GetMovieAsync(id).Wait();
}
catch (AggregateException ex)
{

View File

@ -21,7 +21,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTimezonesList()
{
Timezones result = _config.Client.GetTimezones().Result;
Timezones result = _config.Client.GetTimezonesAsync().Result;
Assert.IsNotNull(result);
Assert.IsTrue(result.List.Count > 200);

View File

@ -46,7 +46,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvEpisodeExtrasNone()
{
TvEpisode tvEpisode = _config.Client.GetTvEpisode(IdHelper.BreakingBad, 1, 1).Result;
TvEpisode tvEpisode = _config.Client.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1).Result;
TestBreakingBadSeasonOneEpisodeOneBaseProperties(tvEpisode);
@ -63,15 +63,15 @@ namespace TMDbLibTests
// Test the custom parsing code for Account State rating
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TvEpisode episode = _config.Client.GetTvEpisode(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates).Result;
TvEpisode episode = _config.Client.GetTvEpisodeAsync(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates).Result;
if (episode.AccountStates == null || !episode.AccountStates.Rating.HasValue)
{
_config.Client.TvEpisodeSetRating(IdHelper.BigBangTheory, 1, 1, 5).Wait();
_config.Client.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 5).Wait();
// Allow TMDb to update cache
Thread.Sleep(2000);
episode = _config.Client.GetTvEpisode(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates).Result;
episode = _config.Client.GetTvEpisodeAsync(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates).Result;
}
Assert.IsNotNull(episode.AccountStates);
@ -85,10 +85,10 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Account states will only show up if we've done something
_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 1, 5).Wait();
_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5).Wait();
TvEpisodeMethods combinedEnum = _methods.Keys.Aggregate((methods, tvEpisodeMethods) => methods | tvEpisodeMethods);
TvEpisode tvEpisode = _config.Client.GetTvEpisode(IdHelper.BreakingBad, 1, 1, combinedEnum).Result;
TvEpisode tvEpisode = _config.Client.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, combinedEnum).Result;
TestBreakingBadSeasonOneEpisodeOneBaseProperties(tvEpisode);
@ -103,13 +103,13 @@ namespace TMDbLibTests
public void TestTvEpisodeExtrasExclusive()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetTvEpisode(id, 1, 1, extras).Result, IdHelper.BreakingBad);
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetTvEpisodeAsync(id, 1, 1, extras).Result, IdHelper.BreakingBad);
}
[TestMethod]
public void TestTvEpisodeSeparateExtrasCredits()
{
Credits credits = _config.Client.GetTvEpisodeCredits(IdHelper.BreakingBad, 1, 1).Result;
Credits credits = _config.Client.GetTvEpisodeCreditsAsync(IdHelper.BreakingBad, 1, 1).Result;
Assert.IsNotNull(credits);
Assert.IsNotNull(credits.Cast);
Assert.AreEqual("Walter White", credits.Cast[0].Character);
@ -132,7 +132,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvEpisodeSeparateExtrasExternalIds()
{
ExternalIds externalIds = _config.Client.GetTvEpisodeExternalIds(IdHelper.BreakingBad, 1, 1).Result;
ExternalIds externalIds = _config.Client.GetTvEpisodeExternalIdsAsync(IdHelper.BreakingBad, 1, 1).Result;
Assert.IsNotNull(externalIds);
Assert.IsTrue(string.IsNullOrEmpty(externalIds.FreebaseId));
Assert.AreEqual(62085, externalIds.Id);
@ -145,7 +145,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvEpisodeSeparateExtrasImages()
{
StillImages images = _config.Client.GetTvEpisodeImages(IdHelper.BreakingBad, 1, 1).Result;
StillImages images = _config.Client.GetTvEpisodeImagesAsync(IdHelper.BreakingBad, 1, 1).Result;
Assert.IsNotNull(images);
Assert.IsNotNull(images.Stills);
}
@ -153,7 +153,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvEpisodeSeparateExtrasVideos()
{
ResultContainer<Video> images = _config.Client.GetTvEpisodeVideos(IdHelper.BreakingBad, 1, 1).Result;
ResultContainer<Video> images = _config.Client.GetTvEpisodeVideosAsync(IdHelper.BreakingBad, 1, 1).Result;
Assert.IsNotNull(images);
Assert.IsNotNull(images.Results);
}
@ -162,36 +162,36 @@ namespace TMDbLibTests
public void TestTvEpisodeAccountStateRatingSet()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TvEpisodeAccountState accountState = _config.Client.GetTvEpisodeAccountState(IdHelper.BreakingBad, 1, 1).Result;
TvEpisodeAccountState accountState = _config.Client.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1).Result;
// Remove the rating
if (accountState.Rating.HasValue)
{
Assert.IsTrue(_config.Client.TvEpisodeRemoveRating(IdHelper.BreakingBad, 1, 1).Result);
Assert.IsTrue(_config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
}
// Test that the episode is NOT rated
accountState = _config.Client.GetTvEpisodeAccountState(IdHelper.BreakingBad, 1, 1).Result;
accountState = _config.Client.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1).Result;
Assert.AreEqual(IdHelper.BreakingBadSeason1Episode1Id, accountState.Id);
Assert.IsFalse(accountState.Rating.HasValue);
// Rate the episode
Assert.IsTrue(_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 1, 5).Result);
Assert.IsTrue(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the episode IS rated
accountState = _config.Client.GetTvEpisodeAccountState(IdHelper.BreakingBad, 1, 1).Result;
accountState = _config.Client.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1).Result;
Assert.AreEqual(IdHelper.BreakingBadSeason1Episode1Id, accountState.Id);
Assert.IsTrue(accountState.Rating.HasValue);
// Remove the rating
Assert.IsTrue(_config.Client.TvEpisodeRemoveRating(IdHelper.BreakingBad, 1, 1).Result);
Assert.IsTrue(_config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1).Result);
}
[TestMethod]
@ -199,15 +199,15 @@ namespace TMDbLibTests
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
Assert.IsFalse(_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 1, -1).Result);
Assert.IsFalse(_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 1, 0).Result);
Assert.IsFalse(_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 1, 10.5).Result);
Assert.IsFalse(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, -1).Result);
Assert.IsFalse(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 0).Result);
Assert.IsFalse(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 10.5).Result);
}
[TestMethod]
public void TestTvEpisodeGetChanges()
{
ChangesContainer changes = _config.Client.GetTvEpisodeChanges(IdHelper.BreakingBadSeason1Episode1Id).Result;
ChangesContainer changes = _config.Client.GetTvEpisodeChangesAsync(IdHelper.BreakingBadSeason1Episode1Id).Result;
Assert.IsNotNull(changes);
Assert.IsNotNull(changes.Changes);
@ -252,8 +252,8 @@ namespace TMDbLibTests
//[TestMethod]
//public void TestMoviesLanguage()
//{
// Movie movie = _config.Client.GetMovie(AGoodDayToDieHard);
// Movie movieItalian = _config.Client.GetMovie(AGoodDayToDieHard, "it");
// Movie movie = _config.Client.GetMovieAsync(AGoodDayToDieHard);
// Movie movieItalian = _config.Client.GetMovieAsync(AGoodDayToDieHard, "it");
// Assert.IsNotNull(movie);
// Assert.IsNotNull(movieItalian);

View File

@ -46,7 +46,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvSeasonExtrasNone()
{
TvSeason tvSeason = _config.Client.GetTvSeason(IdHelper.BreakingBad, 1).Result;
TvSeason tvSeason = _config.Client.GetTvSeasonAsync(IdHelper.BreakingBad, 1).Result;
TestBreakingBadBaseProperties(tvSeason);
@ -63,15 +63,15 @@ namespace TMDbLibTests
// Test the custom parsing code for Account State rating
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TvSeason season = _config.Client.GetTvSeason(IdHelper.BigBangTheory, 1, TvSeasonMethods.AccountStates).Result;
TvSeason season = _config.Client.GetTvSeasonAsync(IdHelper.BigBangTheory, 1, TvSeasonMethods.AccountStates).Result;
if (season.AccountStates == null || season.AccountStates.Results.All(s => s.EpisodeNumber != 1))
{
_config.Client.TvEpisodeSetRating(IdHelper.BigBangTheory, 1, 1, 5).Wait();
_config.Client.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 5).Wait();
// Allow TMDb to update cache
Thread.Sleep(2000);
season = _config.Client.GetTvSeason(IdHelper.BigBangTheory, 1, TvSeasonMethods.AccountStates).Result;
season = _config.Client.GetTvSeasonAsync(IdHelper.BigBangTheory, 1, TvSeasonMethods.AccountStates).Result;
}
Assert.IsNotNull(season.AccountStates);
@ -85,10 +85,10 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Account states will only show up if we've done something
_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 1, 5).Wait();
_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5).Wait();
TvSeasonMethods combinedEnum = _methods.Keys.Aggregate((methods, tvSeasonMethods) => methods | tvSeasonMethods);
TvSeason tvSeason = _config.Client.GetTvSeason(IdHelper.BreakingBad, 1, combinedEnum).Result;
TvSeason tvSeason = _config.Client.GetTvSeasonAsync(IdHelper.BreakingBad, 1, combinedEnum).Result;
TestBreakingBadBaseProperties(tvSeason);
@ -99,13 +99,13 @@ namespace TMDbLibTests
public void TestTvSeasonExtrasExclusive()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetTvSeason(id, 1, extras).Result, IdHelper.BreakingBad);
TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetTvSeasonAsync(id, 1, extras).Result, IdHelper.BreakingBad);
}
[TestMethod]
public void TestTvSeasonSeparateExtrasCredits()
{
Credits credits = _config.Client.GetTvSeasonCredits(IdHelper.BreakingBad, 1).Result;
Credits credits = _config.Client.GetTvSeasonCreditsAsync(IdHelper.BreakingBad, 1).Result;
Assert.IsNotNull(credits);
Assert.IsNotNull(credits.Cast);
Assert.AreEqual("Walter White", credits.Cast[0].Character);
@ -128,7 +128,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvSeasonSeparateExtrasExternalIds()
{
ExternalIds externalIds = _config.Client.GetTvSeasonExternalIds(IdHelper.BreakingBad, 1).Result;
ExternalIds externalIds = _config.Client.GetTvSeasonExternalIdsAsync(IdHelper.BreakingBad, 1).Result;
Assert.IsNotNull(externalIds);
Assert.AreEqual(3572, externalIds.Id);
Assert.AreEqual("/en/breaking_bad_season_1", externalIds.FreebaseId);
@ -141,7 +141,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvSeasonSeparateExtrasImages()
{
PosterImages images = _config.Client.GetTvSeasonImages(IdHelper.BreakingBad, 1).Result;
PosterImages images = _config.Client.GetTvSeasonImagesAsync(IdHelper.BreakingBad, 1).Result;
Assert.IsNotNull(images);
Assert.IsNotNull(images.Posters);
}
@ -149,7 +149,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvSeasonSeparateExtrasVideos()
{
ResultContainer<Video> videos = _config.Client.GetTvSeasonVideos(IdHelper.BreakingBad, 1).Result;
ResultContainer<Video> videos = _config.Client.GetTvSeasonVideosAsync(IdHelper.BreakingBad, 1).Result;
Assert.IsNotNull(videos);
Assert.IsNotNull(videos.Results);
}
@ -157,7 +157,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvSeasonEpisodeCount()
{
TvSeason season = _config.Client.GetTvSeason(IdHelper.BreakingBad, 1).Result;
TvSeason season = _config.Client.GetTvSeasonAsync(IdHelper.BreakingBad, 1).Result;
Assert.IsNotNull(season);
Assert.IsNotNull(season.Episodes);
@ -170,15 +170,15 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Rate episode 1, 2 and 3 of BreakingBad
Assert.IsTrue(_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 1, 5).Result);
Assert.IsTrue(_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 2, 7).Result);
Assert.IsTrue(_config.Client.TvEpisodeSetRating(IdHelper.BreakingBad, 1, 3, 3).Result);
Assert.IsTrue(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5).Result);
Assert.IsTrue(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 2, 7).Result);
Assert.IsTrue(_config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 3, 3).Result);
// Wait for TMDb to un-cache our value
Thread.Sleep(2000);
// Fetch out the seasons state
ResultContainer<TvEpisodeAccountState> state = _config.Client.GetTvSeasonAccountState(IdHelper.BreakingBad, 1).Result;
ResultContainer<TvEpisodeAccountState> state = _config.Client.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1).Result;
Assert.IsNotNull(state);
Assert.IsTrue(Math.Abs(5 - (state.Results.Single(s => s.EpisodeNumber == 1).Rating ?? 0)) < double.Epsilon);
@ -186,14 +186,14 @@ namespace TMDbLibTests
Assert.IsTrue(Math.Abs(3 - (state.Results.Single(s => s.EpisodeNumber == 3).Rating ?? 0)) < double.Epsilon);
// Test deleting Ratings
Assert.IsTrue(_config.Client.TvEpisodeRemoveRating(IdHelper.BreakingBad, 1, 1).Result);
Assert.IsTrue(_config.Client.TvEpisodeRemoveRating(IdHelper.BreakingBad, 1, 2).Result);
Assert.IsTrue(_config.Client.TvEpisodeRemoveRating(IdHelper.BreakingBad, 1, 3).Result);
Assert.IsTrue(_config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1).Result);
Assert.IsTrue(_config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 2).Result);
Assert.IsTrue(_config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 3).Result);
// Wait for TMDb to un-cache our value
Thread.Sleep(2000);
state = _config.Client.GetTvSeasonAccountState(IdHelper.BreakingBad, 1).Result;
state = _config.Client.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1).Result;
Assert.IsNotNull(state);
Assert.IsNull(state.Results.Single(s => s.EpisodeNumber == 1).Rating);
@ -204,7 +204,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvSeasonGetChanges()
{
ChangesContainer changes = _config.Client.GetTvSeasonChanges(IdHelper.BreakingBadSeason1Id).Result;
ChangesContainer changes = _config.Client.GetTvSeasonChangesAsync(IdHelper.BreakingBadSeason1Id).Result;
Assert.IsNotNull(changes);
Assert.IsNotNull(changes.Changes);
}
@ -233,8 +233,8 @@ namespace TMDbLibTests
//[TestMethod]
//public void TestMoviesLanguage()
//{
// Movie movie = _config.Client.GetMovie(AGoodDayToDieHard);
// Movie movieItalian = _config.Client.GetMovie(AGoodDayToDieHard, "it");
// Movie movie = _config.Client.GetMovieAsync(AGoodDayToDieHard);
// Movie movieItalian = _config.Client.GetMovieAsync(AGoodDayToDieHard, "it");
// Assert.IsNotNull(movie);
// Assert.IsNotNull(movieItalian);

View File

@ -49,7 +49,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowExtrasNone()
{
TvShow tvShow = _config.Client.GetTvShow(IdHelper.BreakingBad).Result;
TvShow tvShow = _config.Client.GetTvShowAsync(IdHelper.BreakingBad).Result;
TestBreakingBadBaseProperties(tvShow);
@ -64,10 +64,10 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
// Account states will only show up if we've done something
_config.Client.TvShowSetRating(IdHelper.BreakingBad, 5).Wait();
_config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 5).Wait();
TvShowMethods combinedEnum = _methods.Keys.Aggregate((methods, tvShowMethods) => methods | tvShowMethods);
TvShow tvShow = _config.Client.GetTvShow(IdHelper.BreakingBad, combinedEnum).Result;
TvShow tvShow = _config.Client.GetTvShowAsync(IdHelper.BreakingBad, combinedEnum).Result;
TestBreakingBadBaseProperties(tvShow);
@ -77,7 +77,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSeparateExtrasCredits()
{
Credits credits = _config.Client.GetTvShowCredits(IdHelper.BreakingBad).Result;
Credits credits = _config.Client.GetTvShowCreditsAsync(IdHelper.BreakingBad).Result;
Assert.IsNotNull(credits);
Assert.IsNotNull(credits.Cast);
@ -107,7 +107,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSeparateExtrasExternalIds()
{
ExternalIds externalIds = _config.Client.GetTvShowExternalIds(IdHelper.BreakingBad).Result;
ExternalIds externalIds = _config.Client.GetTvShowExternalIdsAsync(IdHelper.BreakingBad).Result;
Assert.IsNotNull(externalIds);
Assert.AreEqual(1396, externalIds.Id);
Assert.AreEqual("/en/breaking_bad", externalIds.FreebaseId);
@ -121,7 +121,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSeparateExtrasContentRatings()
{
ResultContainer<ContentRating> contentRatings = _config.Client.GetTvShowContentRatings(IdHelper.BreakingBad).Result;
ResultContainer<ContentRating> contentRatings = _config.Client.GetTvShowContentRatingsAsync(IdHelper.BreakingBad).Result;
Assert.IsNotNull(contentRatings);
Assert.AreEqual(IdHelper.BreakingBad, contentRatings.Id);
@ -133,7 +133,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSeparateExtrasAlternativeTitles()
{
ResultContainer<AlternativeTitle> alternativeTitles = _config.Client.GetTvShowAlternativeTitles(IdHelper.BreakingBad).Result;
ResultContainer<AlternativeTitle> alternativeTitles = _config.Client.GetTvShowAlternativeTitlesAsync(IdHelper.BreakingBad).Result;
Assert.IsNotNull(alternativeTitles);
Assert.AreEqual(IdHelper.BreakingBad, alternativeTitles.Id);
@ -145,7 +145,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSeparateExtrasKeywords()
{
ResultContainer<Keyword> keywords = _config.Client.GetTvShowKeywords(IdHelper.BreakingBad).Result;
ResultContainer<Keyword> keywords = _config.Client.GetTvShowKeywordsAsync(IdHelper.BreakingBad).Result;
Assert.IsNotNull(keywords);
Assert.AreEqual(IdHelper.BreakingBad, keywords.Id);
@ -157,7 +157,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSeparateExtrasTranslations()
{
TranslationsContainer translations = _config.Client.GetTvShowTranslations(IdHelper.BreakingBad).Result;
TranslationsContainer translations = _config.Client.GetTvShowTranslationsAsync(IdHelper.BreakingBad).Result;
Assert.IsNotNull(translations);
Assert.AreEqual(IdHelper.BreakingBad, translations.Id);
@ -171,7 +171,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSeparateExtrasVideos()
{
ResultContainer<Video> videos = _config.Client.GetTvShowVideos(IdHelper.BreakingBad).Result;
ResultContainer<Video> videos = _config.Client.GetTvShowVideosAsync(IdHelper.BreakingBad).Result;
Assert.IsNotNull(videos);
Assert.AreEqual(IdHelper.BreakingBad, videos.Id);
@ -193,15 +193,15 @@ namespace TMDbLibTests
// Test the custom parsing code for Account State rating
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
TvShow show = _config.Client.GetTvShow(IdHelper.BigBangTheory, TvShowMethods.AccountStates).Result;
TvShow show = _config.Client.GetTvShowAsync(IdHelper.BigBangTheory, TvShowMethods.AccountStates).Result;
if (show.AccountStates == null || !show.AccountStates.Rating.HasValue)
{
_config.Client.TvShowSetRating(IdHelper.BigBangTheory, 5).Wait();
_config.Client.TvShowSetRatingAsync(IdHelper.BigBangTheory, 5).Wait();
// Allow TMDb to update cache
Thread.Sleep(2000);
show = _config.Client.GetTvShow(IdHelper.BigBangTheory, TvShowMethods.AccountStates).Result;
show = _config.Client.GetTvShowAsync(IdHelper.BigBangTheory, TvShowMethods.AccountStates).Result;
}
Assert.IsNotNull(show.AccountStates);
@ -212,7 +212,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSeparateExtrasImages()
{
ImagesWithId images = _config.Client.GetTvShowImages(IdHelper.BreakingBad).Result;
ImagesWithId images = _config.Client.GetTvShowImagesAsync(IdHelper.BreakingBad).Result;
Assert.IsNotNull(images);
Assert.IsNotNull(images.Backdrops);
Assert.IsNotNull(images.Posters);
@ -282,9 +282,9 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowPopular()
{
TestHelpers.SearchPages(i => _config.Client.GetTvShowPopular(i).Result);
TestHelpers.SearchPages(i => _config.Client.GetTvShowPopularAsync(i).Result);
SearchContainer<SearchTv> result = _config.Client.GetTvShowPopular().Result;
SearchContainer<SearchTv> result = _config.Client.GetTvShowPopularAsync().Result;
Assert.IsNotNull(result.Results[0].Id);
Assert.IsNotNull(result.Results[0].Name);
Assert.IsNotNull(result.Results[0].OriginalName);
@ -296,14 +296,14 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSeasonCount()
{
TvShow tvShow = _config.Client.GetTvShow(1668).Result;
TvShow tvShow = _config.Client.GetTvShowAsync(1668).Result;
Assert.AreEqual(tvShow.Seasons[1].EpisodeCount, 24);
}
[TestMethod]
public void TestTvShowVideos()
{
TvShow tvShow = _config.Client.GetTvShow(1668, TvShowMethods.Videos).Result;
TvShow tvShow = _config.Client.GetTvShowAsync(1668, TvShowMethods.Videos).Result;
Assert.IsNotNull(tvShow.Videos);
Assert.IsNotNull(tvShow.Videos.Results);
Assert.IsNotNull(tvShow.Videos.Results[0]);
@ -320,7 +320,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowTranslations()
{
TranslationsContainer translations = _config.Client.GetTvShowTranslations(1668).Result;
TranslationsContainer translations = _config.Client.GetTvShowTranslationsAsync(1668).Result;
Assert.AreEqual(1668, translations.Id);
Translation translation = translations.Translations.SingleOrDefault(s => s.Iso_639_1 == "hr");
@ -334,7 +334,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowSimilars()
{
SearchContainer<SearchTv> tvShow = _config.Client.GetTvShowSimilar(1668).Result;
SearchContainer<SearchTv> tvShow = _config.Client.GetTvShowSimilarAsync(1668).Result;
Assert.IsNotNull(tvShow);
Assert.IsNotNull(tvShow.Results);
@ -366,9 +366,9 @@ namespace TMDbLibTests
// 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.
TestHelpers.SearchPages(i => _config.Client.GetTvShowTopRated(i).Result);
TestHelpers.SearchPages(i => _config.Client.GetTvShowTopRatedAsync(i).Result);
SearchContainer<SearchTv> result = _config.Client.GetTvShowTopRated().Result;
SearchContainer<SearchTv> result = _config.Client.GetTvShowTopRatedAsync().Result;
Assert.IsNotNull(result.Results[0].Id);
Assert.IsNotNull(result.Results[0].Name);
Assert.IsNotNull(result.Results[0].OriginalName);
@ -380,7 +380,7 @@ namespace TMDbLibTests
[TestMethod]
public void TestTvShowLatest()
{
TvShow tvShow = _config.Client.GetLatestTvShow().Result;
TvShow tvShow = _config.Client.GetLatestTvShowAsync().Result;
Assert.IsNotNull(tvShow);
}
@ -390,7 +390,7 @@ namespace TMDbLibTests
{
foreach (TvShowListType type in Enum.GetValues(typeof(TvShowListType)).OfType<TvShowListType>())
{
TestHelpers.SearchPages(i => _config.Client.GetTvShowList(type, i).Result);
TestHelpers.SearchPages(i => _config.Client.GetTvShowListAsync(type, i).Result);
}
}
@ -398,29 +398,29 @@ namespace TMDbLibTests
public void TestTvShowAccountStateFavoriteSet()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
AccountState accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
AccountState accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
// Remove the favourite
if (accountState.Favorite)
_config.Client.AccountChangeFavoriteStatus(MediaType.TVShow, IdHelper.BreakingBad, false).Wait();
_config.Client.AccountChangeFavoriteStatusAsync(MediaType.TVShow, IdHelper.BreakingBad, false).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie is NOT favourited
accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
Assert.AreEqual(IdHelper.BreakingBad, accountState.Id);
Assert.IsFalse(accountState.Favorite);
// Favourite the movie
_config.Client.AccountChangeFavoriteStatus(MediaType.TVShow, IdHelper.BreakingBad, true).Wait();
_config.Client.AccountChangeFavoriteStatusAsync(MediaType.TVShow, IdHelper.BreakingBad, true).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie IS favourited
accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
Assert.AreEqual(IdHelper.BreakingBad, accountState.Id);
Assert.IsTrue(accountState.Favorite);
}
@ -429,29 +429,29 @@ namespace TMDbLibTests
public void TestTvShowAccountStateWatchlistSet()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
AccountState accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
AccountState accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
// Remove the watchlist
if (accountState.Watchlist)
_config.Client.AccountChangeWatchlistStatus(MediaType.TVShow, IdHelper.BreakingBad, false).Wait();
_config.Client.AccountChangeWatchlistStatusAsync(MediaType.TVShow, IdHelper.BreakingBad, false).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie is NOT watchlisted
accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
Assert.AreEqual(IdHelper.BreakingBad, accountState.Id);
Assert.IsFalse(accountState.Watchlist);
// Watchlist the movie
_config.Client.AccountChangeWatchlistStatus(MediaType.TVShow, IdHelper.BreakingBad, true).Wait();
_config.Client.AccountChangeWatchlistStatusAsync(MediaType.TVShow, IdHelper.BreakingBad, true).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie IS watchlisted
accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
Assert.AreEqual(IdHelper.BreakingBad, accountState.Id);
Assert.IsTrue(accountState.Watchlist);
}
@ -460,12 +460,12 @@ namespace TMDbLibTests
public void TestTvShowAccountStateRatingSet()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
AccountState accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
AccountState accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
// Remove the rating
if (accountState.Rating.HasValue)
{
Assert.IsTrue(_config.Client.TvShowRemoveRating(IdHelper.BreakingBad).Result);
Assert.IsTrue(_config.Client.TvShowRemoveRatingAsync(IdHelper.BreakingBad).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
@ -475,81 +475,81 @@ namespace TMDbLibTests
Thread.Sleep(2000);
// Test that the movie is NOT rated
accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
Assert.AreEqual(IdHelper.BreakingBad, accountState.Id);
Assert.IsFalse(accountState.Rating.HasValue);
// Rate the movie
_config.Client.TvShowSetRating(IdHelper.BreakingBad, 5).Wait();
_config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 5).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the movie IS rated
accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
Assert.AreEqual(IdHelper.BreakingBad, accountState.Id);
Assert.IsTrue(accountState.Rating.HasValue);
// Remove the rating
Assert.IsTrue(_config.Client.TvShowRemoveRating(IdHelper.BreakingBad).Result);
Assert.IsTrue(_config.Client.TvShowRemoveRatingAsync(IdHelper.BreakingBad).Result);
}
[TestMethod]
public void TestTvShowSetRatingBadRating()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
Assert.IsFalse(_config.Client.TvShowSetRating(IdHelper.BreakingBad, 7.1).Result);
Assert.IsFalse(_config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.1).Result);
}
[TestMethod]
public void TestTvShowSetRatingRatingOutOfBounds()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
Assert.IsFalse(_config.Client.TvShowSetRating(IdHelper.BreakingBad, 10.5).Result);
Assert.IsFalse(_config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 10.5).Result);
}
[TestMethod]
public void TestTvShowSetRatingRatingLowerBoundsTest()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
Assert.IsFalse(_config.Client.TvShowSetRating(IdHelper.BreakingBad, 0).Result);
Assert.IsFalse(_config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 0).Result);
}
[TestMethod]
public void TestTvShowSetRatingUserSession()
{
_config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
AccountState accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
AccountState accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
// Remove the rating
if (accountState.Rating.HasValue)
{
Assert.IsTrue(_config.Client.TvShowRemoveRating(IdHelper.BreakingBad).Result);
Assert.IsTrue(_config.Client.TvShowRemoveRatingAsync(IdHelper.BreakingBad).Result);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
}
// Test that the episode is NOT rated
accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
Assert.AreEqual(IdHelper.BreakingBad, accountState.Id);
Assert.IsFalse(accountState.Rating.HasValue);
// Rate the episode
_config.Client.TvShowSetRating(IdHelper.BreakingBad, 5).Wait();
_config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 5).Wait();
// Allow TMDb to cache our changes
Thread.Sleep(2000);
// Test that the episode IS rated
accountState = _config.Client.GetTvShowAccountState(IdHelper.BreakingBad).Result;
accountState = _config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad).Result;
Assert.AreEqual(IdHelper.BreakingBad, accountState.Id);
Assert.IsTrue(accountState.Rating.HasValue);
// Remove the rating
Assert.IsTrue(_config.Client.TvShowRemoveRating(IdHelper.BreakingBad).Result);
Assert.IsTrue(_config.Client.TvShowRemoveRatingAsync(IdHelper.BreakingBad).Result);
}
[TestMethod]
@ -559,17 +559,17 @@ namespace TMDbLibTests
_config.Client.SetSessionInformation(_config.GuestTestSessionId, SessionType.GuestSession);
// Try changing the rating
Assert.IsTrue(_config.Client.TvShowSetRating(IdHelper.BreakingBad, 7.5).Result);
Assert.IsTrue(_config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.5).Result);
// Try changing it back to the previous rating
Assert.IsTrue(_config.Client.TvShowSetRating(IdHelper.BreakingBad, 8).Result);
Assert.IsTrue(_config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 8).Result);
}
//[TestMethod]
//public void TestMoviesLanguage()
//{
// Movie movie = _config.Client.GetMovie(AGoodDayToDieHard);
// Movie movieItalian = _config.Client.GetMovie(AGoodDayToDieHard, "it");
// Movie movie = _config.Client.GetMovieAsync(AGoodDayToDieHard);
// Movie movieItalian = _config.Client.GetMovieAsync(AGoodDayToDieHard, "it");
// Assert.IsNotNull(movie);
// Assert.IsNotNull(movieItalian);

View File

@ -71,16 +71,16 @@ namespace TestApplication
// In the call below, we're fetching the wanted movie from TMDb, but we're also doing something else.
// We're requesting additional data, in this case: Images. This means that the Movie property "Images" will be populated (else it will be null).
// We could combine these properties, requesting even more information in one go:
// client.GetMovie(movieId, MovieMethods.Images);
// client.GetMovie(movieId, MovieMethods.Images | MovieMethods.Releases);
// client.GetMovie(movieId, MovieMethods.Images | MovieMethods.Trailers | MovieMethods.Translations);
// client.GetMovieAsync(movieId, MovieMethods.Images);
// client.GetMovieAsync(movieId, MovieMethods.Images | MovieMethods.Releases);
// client.GetMovieAsync(movieId, MovieMethods.Images | MovieMethods.Trailers | MovieMethods.Translations);
//
// .. and so on..
//
// Note: Each method normally corresponds to a property on the resulting object. If you haven't requested the information, the property will most likely be null.
// Also note, that while we could have used 'client.GetMovieImages()' - it was better to do it like this because we also wanted the Title of the movie.
Movie movie = client.GetMovie(movieId, MovieMethods.Images).Result;
// Also note, that while we could have used 'client.GetMovieImagesAsync()' - it was better to do it like this because we also wanted the Title of the movie.
Movie movie = client.GetMovieAsync(movieId, MovieMethods.Images).Result;
Console.WriteLine("Fetching images for '" + movie.Title + "'");
@ -125,7 +125,7 @@ namespace TestApplication
// This example shows the fetching of a movie.
// Say the user searches for "Thor" in order to find "Thor: The Dark World" or "Thor"
SearchContainer<SearchMovie> results = client.SearchMovie(query).Result;
SearchContainer<SearchMovie> results = client.SearchMovieAsync(query).Result;
// The results is a list, currently on page 1 because we didn't specify any page.
Console.WriteLine("Searched for movies: '" + query + "', found " + results.TotalResults + " results in " +