mirror of
https://github.com/jellyfin/TMDbLib.git
synced 2024-11-23 05:40:12 +00:00
Refactor tests, shorthand TMDbClient
This commit is contained in:
parent
f5cdd0c3e7
commit
591f7cd209
@ -18,23 +18,23 @@ namespace TMDbLibTests
|
||||
{
|
||||
public ClientAccountTests() : base()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Config.UserSessionId))
|
||||
if (string.IsNullOrWhiteSpace(TestConfig.UserSessionId))
|
||||
throw new ConfigurationErrorsException("To successfully complete the ClientAccountTests you will need to specify a valid 'UserSessionId' in the test config file");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAccountGetDetailsGuestAccount()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.GuestTestSessionId, SessionType.GuestSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
await Assert.ThrowsAsync<UserSessionRequiredException>(() => Config.Client.AccountGetDetailsAsync());
|
||||
await Assert.ThrowsAsync<UserSessionRequiredException>(() => TMDbClient.AccountGetDetailsAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAccountGetDetailsUserAccount()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
AccountDetails account = await Config.Client.AccountGetDetailsAsync();
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountDetails account = await TMDbClient.AccountGetDetailsAsync();
|
||||
|
||||
// Naturally the specified account must have these values populated for the test to pass
|
||||
Assert.NotNull(account);
|
||||
@ -52,9 +52,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountAccountGetLists()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.AccountGetListsAsync(i));
|
||||
AccountList list = (await Config.Client.AccountGetListsAsync()).Results[0];
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetListsAsync(i));
|
||||
AccountList list = (await TMDbClient.AccountGetListsAsync()).Results[0];
|
||||
|
||||
Assert.NotNull(list.Id);
|
||||
Assert.NotNull(list.Name);
|
||||
@ -66,9 +66,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountGetFavoriteMovies()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.AccountGetFavoriteMoviesAsync(i));
|
||||
SearchMovie movie = (await Config.Client.AccountGetFavoriteMoviesAsync()).Results[0];
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteMoviesAsync(i));
|
||||
SearchMovie movie = (await TMDbClient.AccountGetFavoriteMoviesAsync()).Results[0];
|
||||
|
||||
// Requires that you have marked at least one movie as favorite else this test will fail
|
||||
Assert.True(movie.Id > 0);
|
||||
@ -90,9 +90,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountGetFavoriteTv()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.AccountGetFavoriteTvAsync(i));
|
||||
SearchTv tvShow = (await Config.Client.AccountGetFavoriteTvAsync()).Results[0];
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteTvAsync(i));
|
||||
SearchTv tvShow = (await TMDbClient.AccountGetFavoriteTvAsync()).Results[0];
|
||||
|
||||
// Requires that you have marked at least one movie as favorite else this test will fail
|
||||
Assert.True(tvShow.Id > 0);
|
||||
@ -114,9 +114,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountGetMovieWatchlist()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.AccountGetFavoriteMoviesAsync(i));
|
||||
SearchMovie movie = (await Config.Client.AccountGetFavoriteMoviesAsync()).Results[0];
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteMoviesAsync(i));
|
||||
SearchMovie movie = (await TMDbClient.AccountGetFavoriteMoviesAsync()).Results[0];
|
||||
|
||||
// Requires that you have added at least one movie to your watchlist else this test will fail
|
||||
Assert.True(movie.Id > 0);
|
||||
@ -138,9 +138,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountGetTvWatchlist()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.AccountGetTvWatchlistAsync(i));
|
||||
SearchTv tvShow = (await Config.Client.AccountGetTvWatchlistAsync()).Results[0];
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetTvWatchlistAsync(i));
|
||||
SearchTv tvShow = (await TMDbClient.AccountGetTvWatchlistAsync()).Results[0];
|
||||
|
||||
// Requires that you have added at least one movie to your watchlist else this test will fail
|
||||
Assert.True(tvShow.Id > 0);
|
||||
@ -162,9 +162,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountGetRatedMovies()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.AccountGetFavoriteMoviesAsync(i));
|
||||
SearchMovie movie = (await Config.Client.AccountGetFavoriteMoviesAsync()).Results[0];
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteMoviesAsync(i));
|
||||
SearchMovie movie = (await TMDbClient.AccountGetFavoriteMoviesAsync()).Results[0];
|
||||
|
||||
// Requires that you have rated at least one movie else this test will fail
|
||||
Assert.True(movie.Id > 0);
|
||||
@ -186,9 +186,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountGetRatedTv()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.AccountGetRatedTvShowsAsync(i));
|
||||
AccountSearchTv tvShow = (await Config.Client.AccountGetRatedTvShowsAsync()).Results[0];
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetRatedTvShowsAsync(i));
|
||||
AccountSearchTv tvShow = (await TMDbClient.AccountGetRatedTvShowsAsync()).Results[0];
|
||||
|
||||
// Requires that you have rated at least one movie else this test will fail
|
||||
Assert.True(tvShow.Id > 0);
|
||||
@ -211,9 +211,9 @@ namespace TMDbLibTests
|
||||
public async Task TestAccountGetRatedTvEpisodes()
|
||||
{
|
||||
// TODO: Error in TMDb: https://www.themoviedb.org/talk/557f1af49251410a2c002480
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.AccountGetRatedTvShowEpisodesAsync(i));
|
||||
AccountSearchTvEpisode tvEpisode = (await Config.Client.AccountGetRatedTvShowEpisodesAsync()).Results[0];
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetRatedTvShowEpisodesAsync(i));
|
||||
AccountSearchTvEpisode tvEpisode = (await TMDbClient.AccountGetRatedTvShowEpisodesAsync()).Results[0];
|
||||
|
||||
// Requires that you have rated at least one movie else this test will fail
|
||||
Assert.True(tvEpisode.Id > 0);
|
||||
@ -231,23 +231,23 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountChangeTvFavoriteStatusAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Ensure that the test movie is not marked as favorite before we start the test
|
||||
if (await DoesFavoriteListContainSpecificTvShow(IdHelper.DoctorWho))
|
||||
Assert.True(await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.DoctorWho, false));
|
||||
Assert.True(await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.DoctorWho, false));
|
||||
|
||||
if (await DoesFavoriteListContainSpecificTvShow(IdHelper.DoctorWho))
|
||||
throw new Exception($"Test tv show '{IdHelper.DoctorWho}' was already marked as favorite. Unable to perform test correctly");
|
||||
|
||||
// Try to mark is as a favorite
|
||||
Assert.True(await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.DoctorWho, true));
|
||||
Assert.True(await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.DoctorWho, true));
|
||||
|
||||
// Check if it worked
|
||||
Assert.True(await DoesFavoriteListContainSpecificTvShow(IdHelper.DoctorWho));
|
||||
|
||||
// Try to un-mark is as a favorite
|
||||
Assert.True(await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.DoctorWho, false));
|
||||
Assert.True(await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.DoctorWho, false));
|
||||
|
||||
// Check if it worked
|
||||
Assert.False(await DoesFavoriteListContainSpecificTvShow(IdHelper.DoctorWho));
|
||||
@ -256,23 +256,23 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountChangeMovieFavoriteStatusAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Ensure that the test movie is not marked as favorite before we start the test
|
||||
if (await DoesFavoriteListContainSpecificMovie(IdHelper.Terminator))
|
||||
Assert.True(await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.Terminator, false));
|
||||
Assert.True(await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.Terminator, false));
|
||||
|
||||
if (await DoesFavoriteListContainSpecificMovie(IdHelper.Terminator))
|
||||
throw new Exception($"Test movie '{IdHelper.Terminator}' was already marked as favorite. Unable to perform test correctly");
|
||||
|
||||
// Try to mark is as a favorite
|
||||
Assert.True(await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.Terminator, true));
|
||||
Assert.True(await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.Terminator, true));
|
||||
|
||||
// Check if it worked
|
||||
Assert.True(await DoesFavoriteListContainSpecificMovie(IdHelper.Terminator));
|
||||
|
||||
// Try to un-mark is as a favorite
|
||||
Assert.True(await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.Terminator, false));
|
||||
Assert.True(await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.Terminator, false));
|
||||
|
||||
// Check if it worked
|
||||
Assert.False(await DoesFavoriteListContainSpecificMovie(IdHelper.Terminator));
|
||||
@ -281,23 +281,23 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountChangeTvWatchlistStatusAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Ensure that the test movie is not marked as favorite before we start the test
|
||||
if (await DoesWatchListContainSpecificTvShow(IdHelper.DoctorWho))
|
||||
Assert.True(await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.DoctorWho, false));
|
||||
Assert.True(await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.DoctorWho, false));
|
||||
|
||||
if (await DoesWatchListContainSpecificTvShow(IdHelper.DoctorWho))
|
||||
throw new Exception($"Test tv show '{IdHelper.DoctorWho}' was already on watchlist. Unable to perform test correctly");
|
||||
|
||||
// Try to add an item to the watchlist
|
||||
Assert.True(await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.DoctorWho, true));
|
||||
Assert.True(await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.DoctorWho, true));
|
||||
|
||||
// Check if it worked
|
||||
Assert.True(await DoesWatchListContainSpecificTvShow(IdHelper.DoctorWho));
|
||||
|
||||
// Try to remove item from watchlist
|
||||
Assert.True(await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.DoctorWho, false));
|
||||
Assert.True(await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.DoctorWho, false));
|
||||
|
||||
// Check if it worked
|
||||
Assert.False(await DoesWatchListContainSpecificTvShow(IdHelper.DoctorWho));
|
||||
@ -306,23 +306,23 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAccountChangeMovieWatchlistStatusAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Ensure that the test movie is not marked as favorite before we start the test
|
||||
if (await DoesWatchListContainSpecificMovie(IdHelper.Terminator))
|
||||
Assert.True(await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.Terminator, false));
|
||||
Assert.True(await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.Terminator, false));
|
||||
|
||||
if (await DoesWatchListContainSpecificMovie(IdHelper.Terminator))
|
||||
throw new Exception($"Test movie '{IdHelper.Terminator}' was already on watchlist. Unable to perform test correctly");
|
||||
|
||||
// Try to add an item to the watchlist
|
||||
Assert.True(await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.Terminator, true));
|
||||
Assert.True(await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.Terminator, true));
|
||||
|
||||
// Check if it worked
|
||||
Assert.True(await DoesWatchListContainSpecificMovie(IdHelper.Terminator));
|
||||
|
||||
// Try to remove item from watchlist
|
||||
Assert.True(await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.Terminator, false));
|
||||
Assert.True(await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.Terminator, false));
|
||||
|
||||
// Check if it worked
|
||||
Assert.False(await DoesWatchListContainSpecificMovie(IdHelper.Terminator));
|
||||
@ -330,22 +330,22 @@ namespace TMDbLibTests
|
||||
|
||||
private async Task<bool> DoesFavoriteListContainSpecificTvShow(int tvId)
|
||||
{
|
||||
return await DoesListContainSpecificMovie(tvId, async page => (await Config.Client.AccountGetFavoriteTvAsync(page)).Results.Select(s => s.Id));
|
||||
return await DoesListContainSpecificMovie(tvId, async page => (await TMDbClient.AccountGetFavoriteTvAsync(page)).Results.Select(s => s.Id));
|
||||
}
|
||||
|
||||
private async Task<bool> DoesWatchListContainSpecificTvShow(int tvId)
|
||||
{
|
||||
return await DoesListContainSpecificMovie(tvId, async page => (await Config.Client.AccountGetTvWatchlistAsync(page)).Results.Select(s => s.Id));
|
||||
return await DoesListContainSpecificMovie(tvId, async page => (await TMDbClient.AccountGetTvWatchlistAsync(page)).Results.Select(s => s.Id));
|
||||
}
|
||||
|
||||
private async Task<bool> DoesFavoriteListContainSpecificMovie(int movieId)
|
||||
{
|
||||
return await DoesListContainSpecificMovie(movieId, async page => (await Config.Client.AccountGetFavoriteMoviesAsync(page)).Results.Select(s => s.Id));
|
||||
return await DoesListContainSpecificMovie(movieId, async page => (await TMDbClient.AccountGetFavoriteMoviesAsync(page)).Results.Select(s => s.Id));
|
||||
}
|
||||
|
||||
private async Task<bool> DoesWatchListContainSpecificMovie(int movieId)
|
||||
{
|
||||
return await DoesListContainSpecificMovie(movieId, async page => (await Config.Client.AccountGetMovieWatchlistAsync(page)).Results.Select(s => s.Id));
|
||||
return await DoesListContainSpecificMovie(movieId, async page => (await TMDbClient.AccountGetMovieWatchlistAsync(page)).Results.Select(s => s.Id));
|
||||
}
|
||||
|
||||
private async Task<bool> DoesListContainSpecificMovie(int movieId, Func<int, Task<IEnumerable<int>>> listGetter)
|
||||
|
@ -14,14 +14,14 @@ namespace TMDbLibTests
|
||||
{
|
||||
public ClientAuthenticationTests()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Config.Username) || string.IsNullOrWhiteSpace(Config.Password))
|
||||
if (string.IsNullOrWhiteSpace(TestConfig.Username) || string.IsNullOrWhiteSpace(TestConfig.Password))
|
||||
throw new ConfigurationErrorsException("You need to provide a username and password or some tests won't be able to execute.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAuthenticationRequestNewToken()
|
||||
{
|
||||
Token token = await Config.Client.AuthenticationRequestAutenticationTokenAsync();
|
||||
Token token = await TMDbClient.AuthenticationRequestAutenticationTokenAsync();
|
||||
|
||||
Assert.NotNull(token);
|
||||
Assert.True(token.Success);
|
||||
@ -52,7 +52,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
const string requestToken = "bla";
|
||||
|
||||
await Assert.ThrowsAsync<UnauthorizedAccessException>(() => Config.Client.AuthenticationGetUserSessionAsync(requestToken));
|
||||
await Assert.ThrowsAsync<UnauthorizedAccessException>(() => TMDbClient.AuthenticationGetUserSessionAsync(requestToken));
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
@ -61,17 +61,17 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestAuthenticationGetUserSessionApiUserValidationSuccessAsync()
|
||||
{
|
||||
Token token = await Config.Client.AuthenticationRequestAutenticationTokenAsync();
|
||||
Token token = await TMDbClient.AuthenticationRequestAutenticationTokenAsync();
|
||||
|
||||
await Config.Client.AuthenticationValidateUserTokenAsync(token.RequestToken, Config.Username, Config.Password);
|
||||
await TMDbClient.AuthenticationValidateUserTokenAsync(token.RequestToken, TestConfig.Username, TestConfig.Password);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAuthenticationGetUserSessionApiUserValidationInvalidLoginAsync()
|
||||
{
|
||||
Token token = await Config.Client.AuthenticationRequestAutenticationTokenAsync();
|
||||
Token token = await TMDbClient.AuthenticationRequestAutenticationTokenAsync();
|
||||
|
||||
await Assert.ThrowsAsync<UnauthorizedAccessException>(() => Config.Client.AuthenticationValidateUserTokenAsync(token.RequestToken, "bla", "bla"));
|
||||
await Assert.ThrowsAsync<UnauthorizedAccessException>(() => TMDbClient.AuthenticationValidateUserTokenAsync(token.RequestToken, "bla", "bla"));
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
@ -80,7 +80,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task AuthenticationGetUserSessionWithLoginSuccess()
|
||||
{
|
||||
UserSession session = await Config.Client.AuthenticationGetUserSessionAsync(Config.Username, Config.Password);
|
||||
UserSession session = await TMDbClient.AuthenticationGetUserSessionAsync(TestConfig.Username, TestConfig.Password);
|
||||
|
||||
Assert.NotNull(session);
|
||||
Assert.True(session.Success);
|
||||
@ -92,13 +92,13 @@ namespace TMDbLibTests
|
||||
{
|
||||
const string requestToken = "5f3a62c0d7977319e3d14adf1a2064c0c0938bcf";
|
||||
|
||||
await Assert.ThrowsAsync<UnauthorizedAccessException>(() => Config.Client.AuthenticationGetUserSessionAsync(requestToken));
|
||||
await Assert.ThrowsAsync<UnauthorizedAccessException>(() => TMDbClient.AuthenticationGetUserSessionAsync(requestToken));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestAuthenticationCreateGuestSessionAsync()
|
||||
{
|
||||
GuestSession guestSession = await Config.Client.AuthenticationCreateGuestSessionAsync();
|
||||
GuestSession guestSession = await TMDbClient.AuthenticationCreateGuestSessionAsync();
|
||||
|
||||
Assert.NotNull(guestSession);
|
||||
Assert.True(guestSession.Success);
|
||||
|
@ -12,7 +12,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCertificationsListMovieAsync()
|
||||
{
|
||||
CertificationsContainer result = await Config.Client.GetMovieCertificationsAsync();
|
||||
CertificationsContainer result = await TMDbClient.GetMovieCertificationsAsync();
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Certifications);
|
||||
Assert.True(result.Certifications.Count > 1);
|
||||
@ -32,7 +32,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCertificationsListTvAsync()
|
||||
{
|
||||
CertificationsContainer result = await Config.Client.GetTvCertificationsAsync();
|
||||
CertificationsContainer result = await TMDbClient.GetTvCertificationsAsync();
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Certifications);
|
||||
Assert.True(result.Certifications.Count > 1);
|
||||
|
@ -14,7 +14,7 @@ namespace TMDbLibTests
|
||||
public async Task TestChangesMoviesAsync()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = await Config.Client.GetChangesMoviesAsync();
|
||||
SearchContainer<ChangesListItem> changesPage1 = await TMDbClient.GetChangesMoviesAsync();
|
||||
|
||||
Assert.NotNull(changesPage1);
|
||||
Assert.True(changesPage1.Results.Count > 0);
|
||||
@ -22,14 +22,14 @@ namespace TMDbLibTests
|
||||
Assert.Equal(1, changesPage1.Page);
|
||||
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = await Config.Client.GetChangesMoviesAsync(2);
|
||||
SearchContainer<ChangesListItem> changesPage2 = await TMDbClient.GetChangesMoviesAsync(2);
|
||||
|
||||
Assert.NotNull(changesPage2);
|
||||
Assert.Equal(2, changesPage2.Page);
|
||||
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-7);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = await Config.Client.GetChangesMoviesAsync(endDate: higher);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = await TMDbClient.GetChangesMoviesAsync(endDate: higher);
|
||||
|
||||
Assert.NotNull(changesMaxDate);
|
||||
Assert.Equal(1, changesMaxDate.Page);
|
||||
@ -37,7 +37,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 = await Config.Client.GetChangesMoviesAsync(startDate: lower);
|
||||
SearchContainer<ChangesListItem> changesLowDate = await TMDbClient.GetChangesMoviesAsync(startDate: lower);
|
||||
|
||||
Assert.NotNull(changesLowDate);
|
||||
Assert.Equal(1, changesLowDate.Page);
|
||||
@ -48,7 +48,7 @@ namespace TMDbLibTests
|
||||
public async Task TestChangesPeopleAsync()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = await Config.Client.GetChangesPeopleAsync();
|
||||
SearchContainer<ChangesListItem> changesPage1 = await TMDbClient.GetChangesPeopleAsync();
|
||||
|
||||
Assert.NotNull(changesPage1);
|
||||
Assert.True(changesPage1.Results.Count > 0);
|
||||
@ -56,14 +56,14 @@ namespace TMDbLibTests
|
||||
Assert.Equal(1, changesPage1.Page);
|
||||
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = await Config.Client.GetChangesPeopleAsync(2);
|
||||
SearchContainer<ChangesListItem> changesPage2 = await TMDbClient.GetChangesPeopleAsync(2);
|
||||
|
||||
Assert.NotNull(changesPage2);
|
||||
Assert.Equal(2, changesPage2.Page);
|
||||
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-7);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = await Config.Client.GetChangesPeopleAsync(endDate: higher);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = await TMDbClient.GetChangesPeopleAsync(endDate: higher);
|
||||
|
||||
Assert.NotNull(changesMaxDate);
|
||||
Assert.Equal(1, changesMaxDate.Page);
|
||||
@ -71,7 +71,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 = await Config.Client.GetChangesPeopleAsync(startDate: lower);
|
||||
SearchContainer<ChangesListItem> changesLowDate = await TMDbClient.GetChangesPeopleAsync(startDate: lower);
|
||||
|
||||
Assert.NotNull(changesLowDate);
|
||||
Assert.Equal(1, changesLowDate.Page);
|
||||
@ -87,7 +87,7 @@ namespace TMDbLibTests
|
||||
public async Task TestChangesTvShowsAsync()
|
||||
{
|
||||
// Basic check
|
||||
SearchContainer<ChangesListItem> changesPage1 = await Config.Client.GetChangesTvAsync();
|
||||
SearchContainer<ChangesListItem> changesPage1 = await TMDbClient.GetChangesTvAsync();
|
||||
|
||||
Assert.NotNull(changesPage1);
|
||||
Assert.NotNull(changesPage1.Results);
|
||||
@ -99,7 +99,7 @@ namespace TMDbLibTests
|
||||
{
|
||||
Assert.True(changesPage1.TotalResults > changesPage1.Results.Count);
|
||||
// Page 2
|
||||
SearchContainer<ChangesListItem> changesPage2 = await Config.Client.GetChangesTvAsync(2);
|
||||
SearchContainer<ChangesListItem> changesPage2 = await TMDbClient.GetChangesTvAsync(2);
|
||||
|
||||
Assert.NotNull(changesPage2);
|
||||
Assert.Equal(2, changesPage2.Page);
|
||||
@ -107,7 +107,7 @@ namespace TMDbLibTests
|
||||
|
||||
// Check date range (max)
|
||||
DateTime higher = DateTime.UtcNow.AddDays(-8);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = await Config.Client.GetChangesTvAsync(endDate: higher);
|
||||
SearchContainer<ChangesListItem> changesMaxDate = await TMDbClient.GetChangesTvAsync(endDate: higher);
|
||||
|
||||
Assert.NotNull(changesMaxDate);
|
||||
Assert.Equal(1, changesMaxDate.Page);
|
||||
@ -115,7 +115,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 = await Config.Client.GetChangesTvAsync(startDate: lower);
|
||||
SearchContainer<ChangesListItem> changesLowDate = await TMDbClient.GetChangesTvAsync(startDate: lower);
|
||||
|
||||
Assert.NotNull(changesLowDate);
|
||||
Assert.Equal(1, changesLowDate.Page);
|
||||
|
@ -24,7 +24,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCollectionsExtrasNone()
|
||||
{
|
||||
Collection collection = await Config.Client.GetCollectionAsync(IdHelper.JamesBondCollection);
|
||||
Collection collection = await TMDbClient.GetCollectionAsync(IdHelper.JamesBondCollection);
|
||||
|
||||
Assert.NotNull(collection);
|
||||
Assert.Equal("James Bond Collection", collection.Name);
|
||||
@ -41,7 +41,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCollectionMissing()
|
||||
{
|
||||
Collection collection = await Config.Client.GetCollectionAsync(IdHelper.MissingID);
|
||||
Collection collection = await TMDbClient.GetCollectionAsync(IdHelper.MissingID);
|
||||
|
||||
Assert.Null(collection);
|
||||
}
|
||||
@ -49,7 +49,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCollectionsParts()
|
||||
{
|
||||
Collection collection = await Config.Client.GetCollectionAsync(IdHelper.JamesBondCollection);
|
||||
Collection collection = await TMDbClient.GetCollectionAsync(IdHelper.JamesBondCollection);
|
||||
|
||||
Assert.NotNull(collection);
|
||||
Assert.Equal("James Bond Collection", collection.Name);
|
||||
@ -64,26 +64,26 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCollectionsExtrasExclusive()
|
||||
{
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => Config.Client.GetCollectionAsync(IdHelper.JamesBondCollection, extras));
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetCollectionAsync(IdHelper.JamesBondCollection, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCollectionsExtrasAll()
|
||||
{
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => Config.Client.GetCollectionAsync(IdHelper.JamesBondCollection, combined));
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetCollectionAsync(IdHelper.JamesBondCollection, combined));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCollectionsImagesAsync()
|
||||
{
|
||||
// Get config
|
||||
await Config.Client.GetConfigAsync();
|
||||
await TMDbClient.GetConfigAsync();
|
||||
|
||||
// Test image url generator
|
||||
ImagesWithId images = await Config.Client.GetCollectionImagesAsync(IdHelper.JamesBondCollection);
|
||||
ImagesWithId images = await TMDbClient.GetCollectionImagesAsync(IdHelper.JamesBondCollection);
|
||||
|
||||
Assert.Equal(IdHelper.JamesBondCollection, images.Id);
|
||||
await TestImagesHelpers.TestImagesAsync(Config, images);
|
||||
await TestImagesHelpers.TestImagesAsync(TestConfig, images);
|
||||
}
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCompaniesExtrasNoneAsync()
|
||||
{
|
||||
Company company = await Config.Client.GetCompanyAsync(IdHelper.TwentiethCenturyFox);
|
||||
Company company = await TMDbClient.GetCompanyAsync(IdHelper.TwentiethCenturyFox);
|
||||
|
||||
Assert.NotNull(company);
|
||||
|
||||
@ -42,19 +42,19 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCompaniesExtrasExclusive()
|
||||
{
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => Config.Client.GetCompanyAsync( IdHelper.TwentiethCenturyFox, extras));
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetCompanyAsync( IdHelper.TwentiethCenturyFox, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCompaniesExtrasAllAsync()
|
||||
{
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => Config.Client.GetCompanyAsync(IdHelper.TwentiethCenturyFox, combined));
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetCompanyAsync(IdHelper.TwentiethCenturyFox, combined));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestCompanyMissingAsync()
|
||||
{
|
||||
Company company = await Config.Client.GetCompanyAsync(IdHelper.MissingID);
|
||||
Company company = await TMDbClient.GetCompanyAsync(IdHelper.MissingID);
|
||||
|
||||
Assert.Null(company);
|
||||
}
|
||||
@ -63,9 +63,9 @@ namespace TMDbLibTests
|
||||
public async Task TestCompaniesGettersAsync()
|
||||
{
|
||||
//GetCompanyMoviesAsync(int id, string language, int page = -1)
|
||||
SearchContainerWithId<SearchMovie> resp = await Config.Client.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox);
|
||||
SearchContainerWithId<SearchMovie> respPage2 = await Config.Client.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox, 2);
|
||||
SearchContainerWithId<SearchMovie> respItalian = await Config.Client.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox, "it");
|
||||
SearchContainerWithId<SearchMovie> resp = await TMDbClient.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox);
|
||||
SearchContainerWithId<SearchMovie> respPage2 = await TMDbClient.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox, 2);
|
||||
SearchContainerWithId<SearchMovie> respItalian = await TMDbClient.GetCompanyMoviesAsync(IdHelper.TwentiethCenturyFox, "it");
|
||||
|
||||
Assert.NotNull(resp);
|
||||
Assert.NotNull(respPage2);
|
||||
@ -91,13 +91,13 @@ namespace TMDbLibTests
|
||||
public async Task TestCompaniesImagesAsync()
|
||||
{
|
||||
// Get config
|
||||
await Config.Client.GetConfigAsync();
|
||||
await TMDbClient.GetConfigAsync();
|
||||
|
||||
// Test image url generator
|
||||
Company company = await Config.Client.GetCompanyAsync(IdHelper.TwentiethCenturyFox);
|
||||
Company company = await TMDbClient.GetCompanyAsync(IdHelper.TwentiethCenturyFox);
|
||||
|
||||
Uri url = Config.Client.GetImageUrl("original", company.LogoPath);
|
||||
Uri urlSecure = Config.Client.GetImageUrl("original", company.LogoPath, true);
|
||||
Uri url = TMDbClient.GetImageUrl("original", company.LogoPath);
|
||||
Uri urlSecure = TMDbClient.GetImageUrl("original", company.LogoPath, true);
|
||||
|
||||
Assert.True(await TestHelpers.InternetUriExistsAsync(url));
|
||||
Assert.True(await TestHelpers.InternetUriExistsAsync(urlSecure));
|
||||
@ -106,7 +106,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCompaniesFullAsync()
|
||||
{
|
||||
Company company = await Config.Client.GetCompanyAsync(IdHelper.ColumbiaPictures);
|
||||
Company company = await TMDbClient.GetCompanyAsync(IdHelper.ColumbiaPictures);
|
||||
|
||||
Assert.NotNull(company);
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestConfigurationAsync()
|
||||
{
|
||||
APIConfiguration result = await Config.Client.GetAPIConfiguration();
|
||||
APIConfiguration result = await TMDbClient.GetAPIConfiguration();
|
||||
|
||||
Assert.NotNull(result);
|
||||
|
||||
@ -26,7 +26,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestPrimaryTranslationsAsync()
|
||||
{
|
||||
List<string> result = await Config.Client.GetPrimaryTranslationsAsync();
|
||||
List<string> result = await TMDbClient.GetPrimaryTranslationsAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
|
||||
@ -36,7 +36,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestCountryListAsync()
|
||||
{
|
||||
List<Country> result = await Config.Client.GetCountriesAsync();
|
||||
List<Country> result = await TMDbClient.GetCountriesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result.Count > 200);
|
||||
@ -47,7 +47,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestLanguageListAsync()
|
||||
{
|
||||
List<Language> result = await Config.Client.GetLanguagesAsync();
|
||||
List<Language> result = await TMDbClient.GetLanguagesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result.Count > 180);
|
||||
@ -58,7 +58,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTimezonesListAsync()
|
||||
{
|
||||
Timezones result = await Config.Client.GetTimezonesAsync();
|
||||
Timezones result = await TMDbClient.GetTimezonesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result.List.Count > 200);
|
||||
@ -72,7 +72,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestJobListAsync()
|
||||
{
|
||||
List<Job> jobs = await Config.Client.GetJobsAsync();
|
||||
List<Job> jobs = await TMDbClient.GetJobsAsync();
|
||||
|
||||
Assert.NotNull(jobs);
|
||||
Assert.True(jobs.Count > 0);
|
||||
|
@ -14,7 +14,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestGetCreditTv()
|
||||
{
|
||||
Credit result = await Config.Client.GetCreditsAsync(IdHelper.BruceWillisMiamiVice);
|
||||
Credit result = await TMDbClient.GetCreditsAsync(IdHelper.BruceWillisMiamiVice);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(CreditType.Cast, result.CreditType);
|
||||
@ -37,7 +37,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestMissingCredit()
|
||||
{
|
||||
Credit result = await Config.Client.GetCreditsAsync(IdHelper.MissingID.ToString());
|
||||
Credit result = await TMDbClient.GetCreditsAsync(IdHelper.MissingID.ToString());
|
||||
|
||||
Assert.Null(result);
|
||||
}
|
||||
@ -45,7 +45,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestGetCreditEpisode()
|
||||
{
|
||||
Credit result = await Config.Client.GetCreditsAsync(IdHelper.BruceWillisMiamiVice);
|
||||
Credit result = await TMDbClient.GetCreditsAsync(IdHelper.BruceWillisMiamiVice);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Media);
|
||||
@ -65,7 +65,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestGetCreditSeasons()
|
||||
{
|
||||
Credit result = await Config.Client.GetCreditsAsync(IdHelper.HughLaurieHouse);
|
||||
Credit result = await TMDbClient.GetCreditsAsync(IdHelper.HughLaurieHouse);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Media);
|
||||
|
@ -16,9 +16,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestDiscoverTvShowsNoParamsAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.DiscoverTvShowsAsync().Query(i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.DiscoverTvShowsAsync().Query(i));
|
||||
|
||||
SearchContainer<SearchTv> result = await Config.Client.DiscoverTvShowsAsync().Query();
|
||||
SearchContainer<SearchTv> result = await TMDbClient.DiscoverTvShowsAsync().Query();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(1, result.Page);
|
||||
@ -29,7 +29,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestDiscoverTvShowsAsync()
|
||||
{
|
||||
DiscoverTv query = Config.Client.DiscoverTvShowsAsync()
|
||||
DiscoverTv query = TMDbClient.DiscoverTvShowsAsync()
|
||||
.WhereVoteCountIsAtLeast(100)
|
||||
.WhereVoteAverageIsAtLeast(2);
|
||||
|
||||
@ -39,9 +39,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestDiscoverMoviesNoParamsAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.DiscoverMoviesAsync().Query(i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.DiscoverMoviesAsync().Query(i));
|
||||
|
||||
SearchContainer<SearchMovie> result = await Config.Client.DiscoverMoviesAsync().Query();
|
||||
SearchContainer<SearchMovie> result = await TMDbClient.DiscoverMoviesAsync().Query();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(1, result.Page);
|
||||
@ -52,7 +52,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestDiscoverMoviesAsync()
|
||||
{
|
||||
DiscoverMovie query = Config.Client.DiscoverMoviesAsync()
|
||||
DiscoverMovie query = TMDbClient.DiscoverMoviesAsync()
|
||||
.WhereVoteCountIsAtLeast(1000)
|
||||
.WhereVoteAverageIsAtLeast(2);
|
||||
|
||||
@ -62,7 +62,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestDiscoverMoviesRegionAsync()
|
||||
{
|
||||
DiscoverMovie query = Config.Client.DiscoverMoviesAsync().WhereReleaseDateIsInRegion("BR").WherePrimaryReleaseDateIsAfter(new DateTime(2017, 01, 01));
|
||||
DiscoverMovie query = TMDbClient.DiscoverMoviesAsync().WhereReleaseDateIsInRegion("BR").WherePrimaryReleaseDateIsAfter(new DateTime(2017, 01, 01));
|
||||
|
||||
await TestHelpers.SearchPagesAsync(i => query.Query(i));
|
||||
}
|
||||
@ -70,7 +70,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestDiscoverMoviesLanguageAsync()
|
||||
{
|
||||
DiscoverMovie query = Config.Client.DiscoverMoviesAsync().WhereLanguageIs("da-DK").WherePrimaryReleaseDateIsAfter(new DateTime(2017, 01, 01));
|
||||
DiscoverMovie query = TMDbClient.DiscoverMoviesAsync().WhereLanguageIs("da-DK").WherePrimaryReleaseDateIsAfter(new DateTime(2017, 01, 01));
|
||||
|
||||
Assert.Equal("Skønheden og Udyret", (await query.Query(0)).Results[11].Title);
|
||||
|
||||
@ -82,7 +82,7 @@ namespace TMDbLibTests
|
||||
[InlineData("zh")]
|
||||
public async Task TestDiscoverMoviesOriginalLanguage(string language)
|
||||
{
|
||||
DiscoverMovie query = Config.Client.DiscoverMoviesAsync().WhereOriginalLanguageIs(language);
|
||||
DiscoverMovie query = TMDbClient.DiscoverMoviesAsync().WhereOriginalLanguageIs(language);
|
||||
List<SearchMovie> results = (await query.Query(0)).Results;
|
||||
|
||||
Assert.NotEmpty(results);
|
||||
|
@ -11,7 +11,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public void TestFindImdbMovie()
|
||||
{
|
||||
Task<FindContainer> result = Config.Client.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbTerminatorId);
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbTerminatorId);
|
||||
Assert.Single(result.Result.MovieResults);
|
||||
Assert.Equal(IdHelper.TmdbTerminatorId, result.Result.MovieResults[0].Id);
|
||||
}
|
||||
@ -19,7 +19,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public void TestFindImdbPerson()
|
||||
{
|
||||
Task<FindContainer> result = Config.Client.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBruceWillis);
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBruceWillis);
|
||||
Assert.Single(result.Result.PersonResults);
|
||||
Assert.Equal(IdHelper.BruceWillis, result.Result.PersonResults[0].Id);
|
||||
}
|
||||
@ -27,7 +27,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public void TestFindImdbTvShowEpisode()
|
||||
{
|
||||
Task<FindContainer> result = Config.Client.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadSeason1Episode1Id);
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadSeason1Episode1Id);
|
||||
Assert.Single(result.Result.TvEpisode);
|
||||
Assert.Equal(IdHelper.BreakingBadSeason1Episode1Id, result.Result.TvEpisode[0].Id);
|
||||
}
|
||||
@ -35,7 +35,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public void TestFindImdbTvShowSeason()
|
||||
{
|
||||
Task<FindContainer> result = Config.Client.FindAsync(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadSeason1Id);
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadSeason1Id);
|
||||
Assert.Single(result.Result.TvEpisode);
|
||||
|
||||
Assert.Single(result.Result.TvSeason);
|
||||
@ -45,7 +45,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public void TestFindTvdbTvShow()
|
||||
{
|
||||
Task<FindContainer> result = Config.Client.FindAsync(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadId);
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.TvDb, IdHelper.TvdbBreakingBadId);
|
||||
Assert.Single(result.Result.TvResults);
|
||||
Assert.Equal(IdHelper.TmdbBreakingBadId, result.Result.TvResults[0].Id);
|
||||
}
|
||||
@ -53,7 +53,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public void TestFindImdbTvShow()
|
||||
{
|
||||
Task<FindContainer> result = Config.Client.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadId);
|
||||
Task<FindContainer> result = TMDbClient.FindAsync(FindExternalSource.Imdb, IdHelper.ImdbBreakingBadId);
|
||||
Assert.Single(result.Result.TvResults);
|
||||
Assert.Equal(IdHelper.TmdbBreakingBadId, result.Result.TvResults[0].Id);
|
||||
}
|
||||
|
@ -14,13 +14,13 @@ namespace TMDbLibTests
|
||||
public async Task TestGenreTvListAsync()
|
||||
{
|
||||
// Default language
|
||||
List<Genre> genres = await Config.Client.GetTvGenresAsync();
|
||||
List<Genre> genres = await TMDbClient.GetTvGenresAsync();
|
||||
|
||||
Assert.NotNull(genres);
|
||||
Assert.True(genres.Count > 0);
|
||||
|
||||
// Another language
|
||||
List<Genre> genresDanish = await Config.Client.GetTvGenresAsync("da");
|
||||
List<Genre> genresDanish = await TMDbClient.GetTvGenresAsync("da");
|
||||
|
||||
Assert.NotNull(genresDanish);
|
||||
Assert.True(genresDanish.Count > 0);
|
||||
@ -35,13 +35,13 @@ namespace TMDbLibTests
|
||||
public async Task TestGenreMovieListAsync()
|
||||
{
|
||||
// Default language
|
||||
List<Genre> genres = await Config.Client.GetMovieGenresAsync();
|
||||
List<Genre> genres = await TMDbClient.GetMovieGenresAsync();
|
||||
|
||||
Assert.NotNull(genres);
|
||||
Assert.True(genres.Count > 0);
|
||||
|
||||
// Another language
|
||||
List<Genre> genresDanish = await Config.Client.GetMovieGenresAsync("da");
|
||||
List<Genre> genresDanish = await TMDbClient.GetMovieGenresAsync("da");
|
||||
|
||||
Assert.NotNull(genresDanish);
|
||||
Assert.True(genresDanish.Count > 0);
|
||||
@ -56,12 +56,12 @@ namespace TMDbLibTests
|
||||
public async Task TestGenreMoviesAsync()
|
||||
{
|
||||
// Get first genre
|
||||
Genre genre = (await Config.Client.GetMovieGenresAsync()).First();
|
||||
Genre genre = (await TMDbClient.GetMovieGenresAsync()).First();
|
||||
|
||||
// Get movies
|
||||
SearchContainerWithId<SearchMovie> movies = await Config.Client.GetGenreMoviesAsync(genre.Id);
|
||||
SearchContainerWithId<SearchMovie> moviesPage2 = await Config.Client.GetGenreMoviesAsync(genre.Id, "it", 2, includeAllMovies: false);
|
||||
SearchContainerWithId<SearchMovie> moviesAll = await Config.Client.GetGenreMoviesAsync(genre.Id, includeAllMovies: true);
|
||||
SearchContainerWithId<SearchMovie> movies = await TMDbClient.GetGenreMoviesAsync(genre.Id);
|
||||
SearchContainerWithId<SearchMovie> moviesPage2 = await TMDbClient.GetGenreMoviesAsync(genre.Id, "it", 2, includeAllMovies: false);
|
||||
SearchContainerWithId<SearchMovie> moviesAll = await TMDbClient.GetGenreMoviesAsync(genre.Id, includeAllMovies: true);
|
||||
|
||||
Assert.Equal(1, movies.Page);
|
||||
Assert.Equal(2, moviesPage2.Page);
|
||||
|
@ -17,15 +17,15 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeSetRatingGuestSessionAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.GuestTestSessionId, SessionType.GuestSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Try changing the rating
|
||||
Assert.True(await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 7.5));
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 7.5));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
SearchContainer<TvEpisodeWithRating> ratings = await Config.Client.GetGuestSessionRatedTvEpisodesAsync();
|
||||
SearchContainer<TvEpisodeWithRating> ratings = await TMDbClient.GetGuestSessionRatedTvEpisodesAsync();
|
||||
|
||||
Assert.False(true, "This test has been failing for some time - TMDb has been made aware, but have not responded");
|
||||
|
||||
@ -59,39 +59,39 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSetRatingGuestSessionAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.GuestTestSessionId, SessionType.GuestSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Try changing the rating
|
||||
Assert.True(await Config.Client.TvShowSetRatingAsync(IdHelper.House, 7.5));
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.House, 7.5));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
SearchContainer<SearchTvShowWithRating> ratings = await Config.Client.GetGuestSessionRatedTvAsync();
|
||||
SearchContainer<SearchTvShowWithRating> ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
|
||||
|
||||
double tmpRating = ratings.Results.Single(s => s.Id == IdHelper.House).Rating;
|
||||
Assert.Contains(ratings.Results, s => s.Id == IdHelper.House);
|
||||
Assert.True(Math.Abs(7.5 - tmpRating) < float.Epsilon);
|
||||
|
||||
// Try changing it back to the previous rating
|
||||
Assert.True(await Config.Client.TvShowSetRatingAsync(IdHelper.House, 8));
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.House, 8));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
ratings = await Config.Client.GetGuestSessionRatedTvAsync();
|
||||
ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
|
||||
|
||||
tmpRating = ratings.Results.Single(s => s.Id == IdHelper.House).Rating;
|
||||
Assert.Contains(ratings.Results, s => s.Id == IdHelper.House);
|
||||
Assert.True(Math.Abs(8 - tmpRating) < float.Epsilon);
|
||||
|
||||
// Try removing the rating
|
||||
Assert.True(await Config.Client.TvShowRemoveRatingAsync(IdHelper.House));
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.House));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
ratings = await Config.Client.GetGuestSessionRatedTvAsync();
|
||||
ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
|
||||
|
||||
Assert.DoesNotContain(ratings.Results, s => s.Id == IdHelper.House);
|
||||
}
|
||||
@ -99,39 +99,39 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingGuestSessionAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.GuestTestSessionId, SessionType.GuestSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Try changing the rating
|
||||
Assert.True(await Config.Client.MovieSetRatingAsync(IdHelper.Terminator, 7.5));
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 7.5));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
SearchContainer<SearchMovieWithRating> ratings = await Config.Client.GetGuestSessionRatedMoviesAsync();
|
||||
SearchContainer<SearchMovieWithRating> ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();
|
||||
|
||||
double tmpRating = ratings.Results.Single(s => s.Id == IdHelper.Terminator).Rating;
|
||||
Assert.Contains(ratings.Results, s => s.Id == IdHelper.Terminator);
|
||||
Assert.True(Math.Abs(7.5 - tmpRating) < float.Epsilon);
|
||||
|
||||
// Try changing it back to the previous rating
|
||||
Assert.True(await Config.Client.MovieSetRatingAsync(IdHelper.Terminator, 8));
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 8));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
ratings = await Config.Client.GetGuestSessionRatedMoviesAsync();
|
||||
ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();
|
||||
|
||||
tmpRating = ratings.Results.Single(s => s.Id == IdHelper.Terminator).Rating;
|
||||
Assert.Contains(ratings.Results, s => s.Id == IdHelper.Terminator);
|
||||
Assert.True(Math.Abs(8 - tmpRating) < float.Epsilon);
|
||||
|
||||
// Try removing the rating
|
||||
Assert.True(await Config.Client.MovieRemoveRatingAsync(IdHelper.Terminator));
|
||||
Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.Terminator));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
ratings = await Config.Client.GetGuestSessionRatedMoviesAsync();
|
||||
ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();
|
||||
|
||||
Assert.DoesNotContain(ratings.Results, s => s.Id == IdHelper.Terminator);
|
||||
}
|
||||
@ -139,16 +139,16 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestGuestSessionGetRatedTvEpisodesAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.GuestTestSessionId, SessionType.GuestSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Ensure we have a rating
|
||||
Assert.True(await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 7.5));
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 7.5));
|
||||
|
||||
// Test paging
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.GetGuestSessionRatedTvEpisodesAsync(i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetGuestSessionRatedTvEpisodesAsync(i));
|
||||
|
||||
// Fetch ratings
|
||||
SearchContainer<TvEpisodeWithRating> result = await Config.Client.GetGuestSessionRatedTvEpisodesAsync();
|
||||
SearchContainer<TvEpisodeWithRating> result = await TMDbClient.GetGuestSessionRatedTvEpisodesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
@ -157,16 +157,16 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestGuestSessionGetRatedTvAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.GuestTestSessionId, SessionType.GuestSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Ensure we have a rating
|
||||
Assert.True(await Config.Client.TvShowSetRatingAsync(IdHelper.BigBangTheory, 7.5));
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.BigBangTheory, 7.5));
|
||||
|
||||
// Test paging
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.GetGuestSessionRatedTvAsync(i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetGuestSessionRatedTvAsync(i));
|
||||
|
||||
// Fetch ratings
|
||||
SearchContainer<SearchTvShowWithRating> result = await Config.Client.GetGuestSessionRatedTvAsync();
|
||||
SearchContainer<SearchTvShowWithRating> result = await TMDbClient.GetGuestSessionRatedTvAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
@ -175,16 +175,16 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestGuestSessionGetRatedMoviesAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.GuestTestSessionId, SessionType.GuestSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Ensure we have a rating
|
||||
Assert.True(await Config.Client.MovieSetRatingAsync(IdHelper.Terminator, 7.5));
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 7.5));
|
||||
|
||||
// Test paging
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.GetGuestSessionRatedMoviesAsync(i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetGuestSessionRatedMoviesAsync(i));
|
||||
|
||||
// Fetch ratings
|
||||
SearchContainer<SearchMovieWithRating> result = await Config.Client.GetGuestSessionRatedMoviesAsync();
|
||||
SearchContainer<SearchMovieWithRating> result = await TMDbClient.GetGuestSessionRatedMoviesAsync();
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
|
@ -14,7 +14,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestKeywordGet()
|
||||
{
|
||||
KeywordsContainer keywords = await Config.Client.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard);
|
||||
KeywordsContainer keywords = await TMDbClient.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.NotNull(keywords);
|
||||
Assert.NotNull(keywords.Keywords);
|
||||
@ -23,7 +23,7 @@ namespace TMDbLibTests
|
||||
// Try to get all keywords
|
||||
foreach (Keyword testKeyword in keywords.Keywords)
|
||||
{
|
||||
Keyword getKeyword = await Config.Client.GetKeywordAsync(testKeyword.Id);
|
||||
Keyword getKeyword = await TMDbClient.GetKeywordAsync(testKeyword.Id);
|
||||
|
||||
Assert.NotNull(getKeyword);
|
||||
|
||||
@ -35,7 +35,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestKeywordsMissing()
|
||||
{
|
||||
KeywordsContainer keywords = await Config.Client.GetMovieKeywordsAsync(IdHelper.MissingID);
|
||||
KeywordsContainer keywords = await TMDbClient.GetMovieKeywordsAsync(IdHelper.MissingID);
|
||||
|
||||
Assert.Null(keywords);
|
||||
}
|
||||
@ -43,7 +43,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestKeywordMovies()
|
||||
{
|
||||
KeywordsContainer keywords = await Config.Client.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard);
|
||||
KeywordsContainer keywords = await TMDbClient.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.NotNull(keywords);
|
||||
Assert.NotNull(keywords.Keywords);
|
||||
@ -53,9 +53,9 @@ namespace TMDbLibTests
|
||||
Keyword testKeyword = keywords.Keywords.First();
|
||||
|
||||
// Get movies
|
||||
SearchContainerWithId<SearchMovie> movies = await Config.Client.GetKeywordMoviesAsync(testKeyword.Id);
|
||||
SearchContainerWithId<SearchMovie> moviesItalian = await Config.Client.GetKeywordMoviesAsync(testKeyword.Id, "it");
|
||||
SearchContainerWithId<SearchMovie> moviesPage2 = await Config.Client.GetKeywordMoviesAsync(testKeyword.Id, 2);
|
||||
SearchContainerWithId<SearchMovie> movies = await TMDbClient.GetKeywordMoviesAsync(testKeyword.Id);
|
||||
SearchContainerWithId<SearchMovie> moviesItalian = await TMDbClient.GetKeywordMoviesAsync(testKeyword.Id, "it");
|
||||
SearchContainerWithId<SearchMovie> moviesPage2 = await TMDbClient.GetKeywordMoviesAsync(testKeyword.Id, 2);
|
||||
|
||||
Assert.NotNull(movies);
|
||||
Assert.NotNull(moviesItalian);
|
||||
|
@ -20,7 +20,7 @@ namespace TMDbLibTests
|
||||
public async Task TestListAsync()
|
||||
{
|
||||
// Get list
|
||||
GenericList list = await Config.Client.GetListAsync(TestListId);
|
||||
GenericList list = await TMDbClient.GetListAsync(TestListId);
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.Equal(TestListId, list.Id);
|
||||
@ -32,7 +32,7 @@ namespace TMDbLibTests
|
||||
|
||||
// Ensure all movies point to this list
|
||||
int page = 1;
|
||||
SearchContainer<ListResult> movieLists = await Config.Client.GetMovieListsAsync(movieResult.Id);
|
||||
SearchContainer<ListResult> movieLists = await TMDbClient.GetMovieListsAsync(movieResult.Id);
|
||||
while (movieLists != null)
|
||||
{
|
||||
// Check if the current result page contains the relevant list
|
||||
@ -44,7 +44,7 @@ namespace TMDbLibTests
|
||||
|
||||
// See if there is an other page we could try, if not the test fails
|
||||
if (movieLists.Page < movieLists.TotalPages)
|
||||
movieLists = await Config.Client.GetMovieListsAsync(movieResult.Id, ++page);
|
||||
movieLists = await TMDbClient.GetMovieListsAsync(movieResult.Id, ++page);
|
||||
else
|
||||
throw new Exception($"Movie '{movieResult.Title}' was not linked to the test list");
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestListMissingAsync()
|
||||
{
|
||||
GenericList list = await Config.Client.GetListAsync(IdHelper.MissingID.ToString());
|
||||
GenericList list = await TMDbClient.GetListAsync(IdHelper.MissingID.ToString());
|
||||
|
||||
Assert.Null(list);
|
||||
}
|
||||
@ -62,20 +62,20 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestListIsMoviePresentFailureAsync()
|
||||
{
|
||||
Assert.False(await Config.Client.GetListIsMoviePresentAsync(TestListId, IdHelper.Terminator));
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await TMDbClient.GetListIsMoviePresentAsync(TestListId, IdHelper.Terminator));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Clear list
|
||||
Assert.True(await Config.Client.ListClearAsync(TestListId));
|
||||
Assert.True(await TMDbClient.ListClearAsync(TestListId));
|
||||
|
||||
// Verify Avatar is not present
|
||||
Assert.False(await Config.Client.GetListIsMoviePresentAsync(TestListId, IdHelper.Avatar));
|
||||
Assert.False(await TMDbClient.GetListIsMoviePresentAsync(TestListId, IdHelper.Avatar));
|
||||
|
||||
// Add Avatar
|
||||
Assert.True(await Config.Client.ListAddMovieAsync(TestListId, IdHelper.Avatar));
|
||||
Assert.True(await TMDbClient.ListAddMovieAsync(TestListId, IdHelper.Avatar));
|
||||
|
||||
// Verify Avatar is present
|
||||
Assert.True(await Config.Client.GetListIsMoviePresentAsync(TestListId, IdHelper.Avatar));
|
||||
Assert.True(await TMDbClient.GetListIsMoviePresentAsync(TestListId, IdHelper.Avatar));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -83,12 +83,12 @@ namespace TMDbLibTests
|
||||
{
|
||||
const string listName = "Test List 123";
|
||||
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
string newListId = await Config.Client.ListCreateAsync(listName);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
string newListId = await TMDbClient.ListCreateAsync(listName);
|
||||
|
||||
Assert.False(string.IsNullOrWhiteSpace(newListId));
|
||||
|
||||
GenericList newlyAddedList = await Config.Client.GetListAsync(newListId);
|
||||
GenericList newlyAddedList = await TMDbClient.GetListAsync(newListId);
|
||||
Assert.NotNull(newlyAddedList);
|
||||
Assert.Equal(listName, newlyAddedList.Name);
|
||||
Assert.Equal("", newlyAddedList.Description); // "" is the default value
|
||||
@ -97,58 +97,58 @@ namespace TMDbLibTests
|
||||
Assert.Empty(newlyAddedList.Items);
|
||||
Assert.False(string.IsNullOrWhiteSpace(newlyAddedList.CreatedBy));
|
||||
|
||||
Assert.True(await Config.Client.ListDeleteAsync(newListId));
|
||||
Assert.True(await TMDbClient.ListDeleteAsync(newListId));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestListDeleteFailureAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Try removing a list with an incorrect id
|
||||
Assert.False(await Config.Client.ListDeleteAsync("bla"));
|
||||
Assert.False(await TMDbClient.ListDeleteAsync("bla"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestListAddAndRemoveMovieAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Add a new movie to the list
|
||||
Assert.True(await Config.Client.ListAddMovieAsync(TestListId, IdHelper.EvanAlmighty));
|
||||
Assert.True(await TMDbClient.ListAddMovieAsync(TestListId, IdHelper.EvanAlmighty));
|
||||
|
||||
// Try again, this time it should fail since the list already contains this movie
|
||||
Assert.False(await Config.Client.ListAddMovieAsync(TestListId, IdHelper.EvanAlmighty));
|
||||
Assert.False(await TMDbClient.ListAddMovieAsync(TestListId, IdHelper.EvanAlmighty));
|
||||
|
||||
// Get list and check if the item was added
|
||||
GenericList listAfterAdd = await Config.Client.GetListAsync(TestListId);
|
||||
GenericList listAfterAdd = await TMDbClient.GetListAsync(TestListId);
|
||||
Assert.Contains(listAfterAdd.Items, m => m.Id == IdHelper.EvanAlmighty);
|
||||
|
||||
// Remove the previously added movie from the list
|
||||
Assert.True(await Config.Client.ListRemoveMovieAsync(TestListId, IdHelper.EvanAlmighty));
|
||||
Assert.True(await TMDbClient.ListRemoveMovieAsync(TestListId, IdHelper.EvanAlmighty));
|
||||
|
||||
// Get list and check if the item was removed
|
||||
GenericList listAfterRemove = await Config.Client.GetListAsync(TestListId);
|
||||
GenericList listAfterRemove = await TMDbClient.GetListAsync(TestListId);
|
||||
Assert.DoesNotContain(listAfterRemove.Items, m => m.Id == IdHelper.EvanAlmighty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestListClearAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Add a new movie to the list
|
||||
Assert.True(await Config.Client.ListAddMovieAsync(TestListId, IdHelper.MadMaxFuryRoad));
|
||||
Assert.True(await TMDbClient.ListAddMovieAsync(TestListId, IdHelper.MadMaxFuryRoad));
|
||||
|
||||
// Get list and check if the item was added
|
||||
GenericList listAfterAdd = await Config.Client.GetListAsync(TestListId);
|
||||
GenericList listAfterAdd = await TMDbClient.GetListAsync(TestListId);
|
||||
Assert.Contains(listAfterAdd.Items, m => m.Id == IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Clear the list
|
||||
Assert.True(await Config.Client.ListClearAsync(TestListId));
|
||||
Assert.True(await TMDbClient.ListClearAsync(TestListId));
|
||||
|
||||
// Get list and check that all items were removed
|
||||
GenericList listAfterRemove = await Config.Client.GetListAsync(TestListId);
|
||||
GenericList listAfterRemove = await TMDbClient.GetListAsync(TestListId);
|
||||
Assert.False(listAfterRemove.Items.Any());
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesExtrasNone()
|
||||
{
|
||||
Movie movie = await Config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard);
|
||||
Movie movie = await TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.NotNull(movie);
|
||||
|
||||
@ -64,8 +64,8 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesExtrasExclusive()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => Config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard, extras));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -74,27 +74,27 @@ namespace TMDbLibTests
|
||||
Dictionary<MovieMethods, Func<Movie, object>> tmpMethods = new Dictionary<MovieMethods, Func<Movie, object>>(_methods);
|
||||
tmpMethods.Remove(MovieMethods.Videos);
|
||||
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Account states will only show up if we've done something
|
||||
await Config.Client.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5);
|
||||
await TMDbClient.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(tmpMethods, combined => Config.Client.GetMovieAsync(IdHelper.TheDarkKnightRisesImdb, combined));
|
||||
await TestMethodsHelper.TestGetAll(tmpMethods, combined => TMDbClient.GetMovieAsync(IdHelper.TheDarkKnightRisesImdb, combined));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesExtrasAll()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => Config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard, combined));
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard, combined));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesLanguage()
|
||||
{
|
||||
Movie movie = await Config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard);
|
||||
Movie movieItalian = await Config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard, "it");
|
||||
Movie movie = await TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard);
|
||||
Movie movieItalian = await TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard, "it");
|
||||
|
||||
Assert.NotNull(movie);
|
||||
Assert.NotNull(movieItalian);
|
||||
@ -113,10 +113,10 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieAlternativeTitles()
|
||||
{
|
||||
AlternativeTitles respUs = await Config.Client.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "US");
|
||||
AlternativeTitles respUs = await TMDbClient.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "US");
|
||||
Assert.NotNull(respUs);
|
||||
|
||||
AlternativeTitles respFrench = await Config.Client.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "FR");
|
||||
AlternativeTitles respFrench = await TMDbClient.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "FR");
|
||||
Assert.NotNull(respFrench);
|
||||
|
||||
Assert.DoesNotContain(respUs.Titles, s => s.Title == "Duro de matar 5");
|
||||
@ -129,7 +129,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieReleaseDates()
|
||||
{
|
||||
ResultContainer<ReleaseDatesContainer> resp = await Config.Client.GetMovieReleaseDatesAsync(IdHelper.AGoodDayToDieHard);
|
||||
ResultContainer<ReleaseDatesContainer> resp = await TMDbClient.GetMovieReleaseDatesAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
ReleaseDatesContainer releasesUs = resp.Results.SingleOrDefault(s => s.Iso_3166_1 == "US");
|
||||
@ -148,12 +148,12 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieAlternativeTitlesCountry()
|
||||
{
|
||||
AlternativeTitles respUs = await Config.Client.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "US");
|
||||
AlternativeTitles respUs = await TMDbClient.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard, "US");
|
||||
Assert.NotNull(respUs);
|
||||
|
||||
Config.Client.DefaultCountry = "US";
|
||||
TMDbClient.DefaultCountry = "US";
|
||||
|
||||
AlternativeTitles respUs2 = await Config.Client.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard);
|
||||
AlternativeTitles respUs2 = await TMDbClient.GetMovieAlternativeTitlesAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(respUs2);
|
||||
|
||||
Assert.Equal(respUs.Titles.Count, respUs2.Titles.Count);
|
||||
@ -162,7 +162,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieCasts()
|
||||
{
|
||||
Credits resp = await Config.Client.GetMovieCreditsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Credits resp = await TMDbClient.GetMovieCreditsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Cast cast = resp.Cast.SingleOrDefault(s => s.Name == "Bruce Willis");
|
||||
@ -193,7 +193,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetExternalIds()
|
||||
{
|
||||
ExternalIdsMovie externalIds = await Config.Client.GetMovieExternalIdsAsync(IdHelper.BladeRunner2049);
|
||||
ExternalIdsMovie externalIds = await TMDbClient.GetMovieExternalIdsAsync(IdHelper.BladeRunner2049);
|
||||
|
||||
Assert.NotNull(externalIds);
|
||||
Assert.Equal(335984, externalIds.Id);
|
||||
@ -206,7 +206,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieImages()
|
||||
{
|
||||
ImagesWithId resp = await Config.Client.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard);
|
||||
ImagesWithId resp = await TMDbClient.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
ImageData backdrop = resp.Backdrops.SingleOrDefault(s => s.FilePath == "/17zArExB7ztm6fjUXZwQWgGMC9f.jpg");
|
||||
@ -235,7 +235,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieImagesWithImageLanguage()
|
||||
{
|
||||
ImagesWithId resp = await Config.Client.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard, language: "en-US", includeImageLanguage: "en");
|
||||
ImagesWithId resp = await TMDbClient.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard, language: "en-US", includeImageLanguage: "en");
|
||||
|
||||
Assert.True(resp.Backdrops.Count > 0);
|
||||
Assert.True(resp.Posters.Count > 0);
|
||||
@ -244,7 +244,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieWithImageLanguage()
|
||||
{
|
||||
Movie resp = await Config.Client.GetMovieAsync(IdHelper.Avatar, language: "en-US", includeImageLanguage: "en", extraMethods: MovieMethods.Images);
|
||||
Movie resp = await TMDbClient.GetMovieAsync(IdHelper.Avatar, language: "en-US", includeImageLanguage: "en", extraMethods: MovieMethods.Images);
|
||||
|
||||
Assert.True(resp.Images.Backdrops.Count > 0);
|
||||
Assert.True(resp.Images.Backdrops.All(b => b.Iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase)));
|
||||
@ -255,7 +255,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieKeywords()
|
||||
{
|
||||
KeywordsContainer resp = await Config.Client.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard);
|
||||
KeywordsContainer resp = await TMDbClient.GetMovieKeywordsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Keyword keyword = resp.Keywords.SingleOrDefault(s => s.Id == 186447);
|
||||
@ -268,7 +268,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieReleases()
|
||||
{
|
||||
Releases resp = await Config.Client.GetMovieReleasesAsync(IdHelper.AGoodDayToDieHard);
|
||||
Releases resp = await TMDbClient.GetMovieReleasesAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Country country = resp.Countries.SingleOrDefault(s => s.Iso_3166_1 == "US");
|
||||
@ -283,7 +283,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieVideos()
|
||||
{
|
||||
ResultContainer<Video> resp = await Config.Client.GetMovieVideosAsync(IdHelper.AGoodDayToDieHard);
|
||||
ResultContainer<Video> resp = await TMDbClient.GetMovieVideosAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Assert.NotNull(resp);
|
||||
@ -305,7 +305,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestMoviesGetMovieWatchProviders()
|
||||
{
|
||||
SingleResultContainer<Dictionary<string, WatchProviders>> resp = await Config.Client.GetMovieWatchProvidersAsync(IdHelper.AGoodDayToDieHard);
|
||||
SingleResultContainer<Dictionary<string, WatchProviders>> resp = await TMDbClient.GetMovieWatchProvidersAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.NotNull(resp);
|
||||
|
||||
@ -318,7 +318,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieTranslations()
|
||||
{
|
||||
TranslationsContainer resp = await Config.Client.GetMovieTranslationsAsync(IdHelper.AGoodDayToDieHard);
|
||||
TranslationsContainer resp = await TMDbClient.GetMovieTranslationsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Translation translation = resp.Translations.SingleOrDefault(s => s.EnglishName == "German");
|
||||
@ -333,10 +333,10 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieSimilarMovies()
|
||||
{
|
||||
SearchContainer<SearchMovie> resp = await Config.Client.GetMovieSimilarAsync(IdHelper.AGoodDayToDieHard);
|
||||
SearchContainer<SearchMovie> resp = await TMDbClient.GetMovieSimilarAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
SearchContainer<SearchMovie> respGerman = await Config.Client.GetMovieSimilarAsync(IdHelper.AGoodDayToDieHard, language: "de");
|
||||
SearchContainer<SearchMovie> respGerman = await TMDbClient.GetMovieSimilarAsync(IdHelper.AGoodDayToDieHard, language: "de");
|
||||
Assert.NotNull(respGerman);
|
||||
|
||||
Assert.Equal(resp.Results.Count, respGerman.Results.Count);
|
||||
@ -356,10 +356,10 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieRecommendationsMovies()
|
||||
{
|
||||
SearchContainer<SearchMovie> resp = await Config.Client.GetMovieRecommendationsAsync(IdHelper.AGoodDayToDieHard);
|
||||
SearchContainer<SearchMovie> resp = await TMDbClient.GetMovieRecommendationsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
SearchContainer<SearchMovie> respGerman = await Config.Client.GetMovieRecommendationsAsync(IdHelper.AGoodDayToDieHard, language: "de");
|
||||
SearchContainer<SearchMovie> respGerman = await TMDbClient.GetMovieRecommendationsAsync(IdHelper.AGoodDayToDieHard, language: "de");
|
||||
Assert.NotNull(respGerman);
|
||||
|
||||
Assert.Equal(resp.Results.Count, respGerman.Results.Count);
|
||||
@ -379,7 +379,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieReviews()
|
||||
{
|
||||
SearchContainerWithId<ReviewBase> resp = await Config.Client.GetMovieReviewsAsync(IdHelper.TheDarkKnightRises);
|
||||
SearchContainerWithId<ReviewBase> resp = await TMDbClient.GetMovieReviewsAsync(IdHelper.TheDarkKnightRises);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
Assert.NotEqual(0, resp.Results.Count);
|
||||
@ -389,11 +389,11 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGetMovieLists()
|
||||
{
|
||||
SearchContainerWithId<ListResult> resp = await Config.Client.GetMovieListsAsync(IdHelper.AGoodDayToDieHard);
|
||||
SearchContainerWithId<ListResult> resp = await TMDbClient.GetMovieListsAsync(IdHelper.AGoodDayToDieHard);
|
||||
Assert.NotNull(resp);
|
||||
Assert.Equal(IdHelper.AGoodDayToDieHard, resp.Id);
|
||||
|
||||
SearchContainerWithId<ListResult> respPage2 = await Config.Client.GetMovieListsAsync(IdHelper.AGoodDayToDieHard, 2);
|
||||
SearchContainerWithId<ListResult> respPage2 = await TMDbClient.GetMovieListsAsync(IdHelper.AGoodDayToDieHard, 2);
|
||||
Assert.NotNull(respPage2);
|
||||
|
||||
Assert.Equal(1, resp.Page);
|
||||
@ -406,13 +406,13 @@ namespace TMDbLibTests
|
||||
{
|
||||
//GetMovieChangesAsync(int id, DateTime? startDate = null, DateTime? endDate = null)
|
||||
// FindAsync latest changed title
|
||||
Movie lastestMovie = await Config.Client.GetMovieLatestAsync();
|
||||
Movie lastestMovie = await TMDbClient.GetMovieLatestAsync();
|
||||
int latestChanged = lastestMovie.Id;
|
||||
|
||||
// Fetch changelog
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-13);
|
||||
DateTime higher = DateTime.UtcNow.AddDays(1);
|
||||
List<Change> respRange = await Config.Client.GetMovieChangesAsync(latestChanged, lower, higher);
|
||||
List<Change> respRange = await TMDbClient.GetMovieChangesAsync(latestChanged, lower, higher);
|
||||
|
||||
Assert.NotNull(respRange);
|
||||
Assert.True(respRange.Count > 0);
|
||||
@ -433,10 +433,10 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesMissing()
|
||||
{
|
||||
Movie movie1 = await Config.Client.GetMovieAsync(IdHelper.MissingID);
|
||||
Movie movie1 = await TMDbClient.GetMovieAsync(IdHelper.MissingID);
|
||||
Assert.Null(movie1);
|
||||
|
||||
Movie movie2 = await Config.Client.GetMovieAsync(IdHelper.MissingMovie);
|
||||
Movie movie2 = await TMDbClient.GetMovieAsync(IdHelper.MissingMovie);
|
||||
Assert.Null(movie2);
|
||||
}
|
||||
|
||||
@ -444,31 +444,31 @@ namespace TMDbLibTests
|
||||
public async Task TestMoviesImagesAsync()
|
||||
{
|
||||
// Get config
|
||||
await Config.Client.GetConfigAsync();
|
||||
await TMDbClient.GetConfigAsync();
|
||||
|
||||
// Test image url generator
|
||||
ImagesWithId images = await Config.Client.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard);
|
||||
ImagesWithId images = await TMDbClient.GetMovieImagesAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.Equal(IdHelper.AGoodDayToDieHard, images.Id);
|
||||
await TestImagesHelpers.TestImagesAsync(Config, images);
|
||||
await TestImagesHelpers.TestImagesAsync(TestConfig, images);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesPopularList()
|
||||
{
|
||||
SearchContainer<SearchMovie> list = await Config.Client.GetMoviePopularListAsync();
|
||||
SearchContainer<SearchMovie> list = await TMDbClient.GetMoviePopularListAsync();
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainer<SearchMovie> listPage2 = await Config.Client.GetMoviePopularListAsync(page: 2);
|
||||
SearchContainer<SearchMovie> listPage2 = await TMDbClient.GetMoviePopularListAsync(page: 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainer<SearchMovie> listDe = await Config.Client.GetMoviePopularListAsync("de");
|
||||
SearchContainer<SearchMovie> listDe = await TMDbClient.GetMoviePopularListAsync("de");
|
||||
|
||||
Assert.NotNull(listDe);
|
||||
Assert.True(listDe.Results.Count > 0);
|
||||
@ -477,7 +477,7 @@ namespace TMDbLibTests
|
||||
// At least one title should differ
|
||||
Assert.Contains(list.Results, s => listDe.Results.Any(x => x.Title != s.Title));
|
||||
|
||||
SearchContainer<SearchMovie> listRegion = await Config.Client.GetMoviePopularListAsync(region: "de");
|
||||
SearchContainer<SearchMovie> listRegion = await TMDbClient.GetMoviePopularListAsync(region: "de");
|
||||
|
||||
Assert.NotNull(listRegion);
|
||||
Assert.True(listRegion.Results.Count > 0);
|
||||
@ -490,19 +490,19 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesTopRatedList()
|
||||
{
|
||||
SearchContainer<SearchMovie> list = await Config.Client.GetMovieTopRatedListAsync();
|
||||
SearchContainer<SearchMovie> list = await TMDbClient.GetMovieTopRatedListAsync();
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainer<SearchMovie> listPage2 = await Config.Client.GetMovieTopRatedListAsync(page: 2);
|
||||
SearchContainer<SearchMovie> listPage2 = await TMDbClient.GetMovieTopRatedListAsync(page: 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainer<SearchMovie> listDe = await Config.Client.GetMovieTopRatedListAsync("de");
|
||||
SearchContainer<SearchMovie> listDe = await TMDbClient.GetMovieTopRatedListAsync("de");
|
||||
|
||||
Assert.NotNull(listDe);
|
||||
Assert.True(listDe.Results.Count > 0);
|
||||
@ -511,7 +511,7 @@ namespace TMDbLibTests
|
||||
// At least one title should differ
|
||||
Assert.Contains(list.Results, s => listDe.Results.Any(x => x.Title != s.Title));
|
||||
|
||||
SearchContainer<SearchMovie> listRegion = await Config.Client.GetMovieTopRatedListAsync(region: "de");
|
||||
SearchContainer<SearchMovie> listRegion = await TMDbClient.GetMovieTopRatedListAsync(region: "de");
|
||||
|
||||
Assert.NotNull(listRegion);
|
||||
Assert.True(listRegion.Results.Count > 0);
|
||||
@ -524,19 +524,19 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesNowPlayingList()
|
||||
{
|
||||
SearchContainerWithDates<SearchMovie> list = await Config.Client.GetMovieNowPlayingListAsync();
|
||||
SearchContainerWithDates<SearchMovie> list = await TMDbClient.GetMovieNowPlayingListAsync();
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listPage2 = await Config.Client.GetMovieNowPlayingListAsync(page: 2);
|
||||
SearchContainerWithDates<SearchMovie> listPage2 = await TMDbClient.GetMovieNowPlayingListAsync(page: 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listDe = await Config.Client.GetMovieNowPlayingListAsync("de");
|
||||
SearchContainerWithDates<SearchMovie> listDe = await TMDbClient.GetMovieNowPlayingListAsync("de");
|
||||
|
||||
Assert.NotNull(listDe);
|
||||
Assert.True(listDe.Results.Count > 0);
|
||||
@ -545,7 +545,7 @@ namespace TMDbLibTests
|
||||
// At least one title should differ
|
||||
Assert.Contains(list.Results, s => listDe.Results.Any(x => x.Title != s.Title));
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listRegion = await Config.Client.GetMovieNowPlayingListAsync(region: "de");
|
||||
SearchContainerWithDates<SearchMovie> listRegion = await TMDbClient.GetMovieNowPlayingListAsync(region: "de");
|
||||
|
||||
Assert.NotNull(listRegion);
|
||||
Assert.True(listRegion.Results.Count > 0);
|
||||
@ -558,19 +558,19 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesUpcomingList()
|
||||
{
|
||||
SearchContainerWithDates<SearchMovie> list = await Config.Client.GetMovieUpcomingListAsync();
|
||||
SearchContainerWithDates<SearchMovie> list = await TMDbClient.GetMovieUpcomingListAsync();
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listPage2 = await Config.Client.GetMovieUpcomingListAsync(page: 2);
|
||||
SearchContainerWithDates<SearchMovie> listPage2 = await TMDbClient.GetMovieUpcomingListAsync(page: 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listDe = await Config.Client.GetMovieUpcomingListAsync(language: "de");
|
||||
SearchContainerWithDates<SearchMovie> listDe = await TMDbClient.GetMovieUpcomingListAsync(language: "de");
|
||||
|
||||
Assert.NotNull(listDe);
|
||||
Assert.True(listDe.Results.Count > 0);
|
||||
@ -579,7 +579,7 @@ namespace TMDbLibTests
|
||||
// At least one title should differ
|
||||
Assert.Contains(list.Results, s => listDe.Results.Any(x => x.Title != s.Title));
|
||||
|
||||
SearchContainerWithDates<SearchMovie> listDeRegion = await Config.Client.GetMovieUpcomingListAsync(region: "de");
|
||||
SearchContainerWithDates<SearchMovie> listDeRegion = await TMDbClient.GetMovieUpcomingListAsync(region: "de");
|
||||
|
||||
Assert.NotNull(listDeRegion);
|
||||
Assert.True(listDeRegion.Results.Count > 0);
|
||||
@ -592,30 +592,30 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestMoviesAccountStateFavoriteSetAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Remove the favourite
|
||||
if (accountState.Favorite)
|
||||
await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false);
|
||||
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie is NOT favourited
|
||||
accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.False(accountState.Favorite);
|
||||
|
||||
// Favourite the movie
|
||||
await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true);
|
||||
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie IS favourited
|
||||
accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.True(accountState.Favorite);
|
||||
}
|
||||
@ -623,30 +623,30 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestMoviesAccountStateWatchlistSetAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Remove the watchlist
|
||||
if (accountState.Watchlist)
|
||||
await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false);
|
||||
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie is NOT watchlisted
|
||||
accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.False(accountState.Watchlist);
|
||||
|
||||
// Watchlist the movie
|
||||
await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true);
|
||||
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie IS watchlisted
|
||||
accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.True(accountState.Watchlist);
|
||||
}
|
||||
@ -654,95 +654,95 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestMoviesAccountStateRatingSetAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
// Remove the rating
|
||||
if (accountState.Rating.HasValue)
|
||||
{
|
||||
Assert.True(await Config.Client.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad));
|
||||
Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
|
||||
// Test that the movie is NOT rated
|
||||
accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.False(accountState.Rating.HasValue);
|
||||
|
||||
// Rate the movie
|
||||
await Config.Client.MovieSetRatingAsync(IdHelper.MadMaxFuryRoad, 5);
|
||||
await TMDbClient.MovieSetRatingAsync(IdHelper.MadMaxFuryRoad, 5);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie IS rated
|
||||
accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
|
||||
Assert.Equal(IdHelper.MadMaxFuryRoad, accountState.Id);
|
||||
Assert.True(accountState.Rating.HasValue);
|
||||
|
||||
// Remove the rating
|
||||
Assert.True(await Config.Client.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad));
|
||||
Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingBadRating()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await Config.Client.MovieSetRatingAsync(IdHelper.Avatar, 7.1));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, 7.1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingRatingOutOfBounds()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await Config.Client.MovieSetRatingAsync(IdHelper.Avatar, 10.5));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, 10.5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingRatingLowerBoundsTest()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await Config.Client.MovieSetRatingAsync(IdHelper.Avatar, 0));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestMoviesSetRatingUserSession()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Ensure that the test movie has a different rating than our test rating
|
||||
double? rating = (await Config.Client.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating;
|
||||
double? rating = (await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating;
|
||||
Assert.NotNull(rating);
|
||||
|
||||
double originalRating = rating.Value;
|
||||
double newRating = Math.Abs(originalRating - 7.5) < double.Epsilon ? 2.5 : 7.5;
|
||||
|
||||
// Try changing the rating
|
||||
Assert.True(await Config.Client.MovieSetRatingAsync(IdHelper.Avatar, newRating));
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, newRating));
|
||||
|
||||
// Allow TMDb to not cache our data
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Check if it worked
|
||||
Assert.Equal(newRating, (await Config.Client.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating);
|
||||
Assert.Equal(newRating, (await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating);
|
||||
|
||||
// Try changing it back to the previous rating
|
||||
Assert.True(await Config.Client.MovieSetRatingAsync(IdHelper.Avatar, originalRating));
|
||||
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, originalRating));
|
||||
|
||||
// Allow TMDb to not cache our data
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Check if it worked
|
||||
Assert.Equal(originalRating, (await Config.Client.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating);
|
||||
Assert.Equal(originalRating, (await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void TestMoviesGetHtmlEncodedText()
|
||||
{
|
||||
Movie item = await Config.Client.GetMovieAsync(IdHelper.Furious7, "de");
|
||||
Movie item = await TMDbClient.GetMovieAsync(IdHelper.Furious7, "de");
|
||||
|
||||
Assert.NotNull(item);
|
||||
|
||||
@ -752,7 +752,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async void TestMoviesGet()
|
||||
{
|
||||
Movie item = await Config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard);
|
||||
Movie item = await TMDbClient.GetMovieAsync(IdHelper.AGoodDayToDieHard);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(IdHelper.AGoodDayToDieHard, item.Id);
|
||||
@ -802,17 +802,17 @@ namespace TMDbLibTests
|
||||
public async Task TestMoviesExtrasAccountStateAsync()
|
||||
{
|
||||
// Test the custom parsing code for Account State rating
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
Movie movie = await Config.Client.GetMovieAsync(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates);
|
||||
Movie movie = await TMDbClient.GetMovieAsync(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates);
|
||||
if (movie.AccountStates == null || !movie.AccountStates.Rating.HasValue)
|
||||
{
|
||||
await Config.Client.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5);
|
||||
await TMDbClient.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5);
|
||||
|
||||
// Allow TMDb to update cache
|
||||
Thread.Sleep(2000);
|
||||
|
||||
movie = await Config.Client.GetMovieAsync(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates);
|
||||
movie = await TMDbClient.GetMovieAsync(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates);
|
||||
}
|
||||
|
||||
Assert.NotNull(movie.AccountStates);
|
||||
|
@ -12,7 +12,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestNetworkGetByIdAsync()
|
||||
{
|
||||
Network network = await Config.Client.GetNetworkAsync(IdHelper.Netflix);
|
||||
Network network = await TMDbClient.GetNetworkAsync(IdHelper.Netflix);
|
||||
|
||||
Assert.NotNull(network);
|
||||
Assert.Equal("Netflix", network.Name);
|
||||
@ -24,7 +24,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestNetworkImagesAsync()
|
||||
{
|
||||
NetworkLogos logos = await Config.Client.GetNetworkImagesAsync(IdHelper.Netflix);
|
||||
NetworkLogos logos = await TMDbClient.GetNetworkImagesAsync(IdHelper.Netflix);
|
||||
|
||||
Assert.NotNull(logos);
|
||||
Assert.Equal(IdHelper.Netflix, logos.Id);
|
||||
@ -34,7 +34,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestNetworkAlternativeNamesAsync()
|
||||
{
|
||||
AlternativeNames names = await Config.Client.GetNetworkAlternativeNamesAsync(IdHelper.AMC);
|
||||
AlternativeNames names = await TMDbClient.GetNetworkAlternativeNamesAsync(IdHelper.AMC);
|
||||
|
||||
Assert.NotNull(names);
|
||||
Assert.Equal(IdHelper.AMC, names.Id);
|
||||
@ -45,7 +45,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestNetworkMissingAsync()
|
||||
{
|
||||
Network network = await Config.Client.GetNetworkAsync(IdHelper.MissingID);
|
||||
Network network = await TMDbClient.GetNetworkAsync(IdHelper.MissingID);
|
||||
|
||||
Assert.Null(network);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestPersonsExtrasNoneAsync()
|
||||
{
|
||||
Person person = await Config.Client.GetPersonAsync(IdHelper.BruceWillis);
|
||||
Person person = await TMDbClient.GetPersonAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(person);
|
||||
|
||||
@ -48,19 +48,19 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestPersonsExtrasExclusive()
|
||||
{
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => Config.Client.GetPersonAsync(IdHelper.BruceWillis, extras));
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetPersonAsync(IdHelper.BruceWillis, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsExtrasAllAsync()
|
||||
{
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => Config.Client.GetPersonAsync(IdHelper.BruceWillis, combined));
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetPersonAsync(IdHelper.BruceWillis, combined));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestPersonsGetWithPartialDateAsync()
|
||||
{
|
||||
Person item = await Config.Client.GetPersonAsync(IdHelper.PersonPartialDate);
|
||||
Person item = await TMDbClient.GetPersonAsync(IdHelper.PersonPartialDate);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Null(item.Birthday);
|
||||
@ -70,7 +70,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestPersonMissingAsync()
|
||||
{
|
||||
Person person = await Config.Client.GetPersonAsync(IdHelper.MissingID);
|
||||
Person person = await TMDbClient.GetPersonAsync(IdHelper.MissingID);
|
||||
|
||||
Assert.Null(person);
|
||||
}
|
||||
@ -78,7 +78,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestPersonsGetAsync()
|
||||
{
|
||||
Person item = await Config.Client.GetPersonAsync(IdHelper.BruceWillis);
|
||||
Person item = await TMDbClient.GetPersonAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.False(item.Adult);
|
||||
@ -103,7 +103,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestPersonsGetPersonTvCreditsAsync()
|
||||
{
|
||||
TvCredits item = await Config.Client.GetPersonTvCreditsAsync(IdHelper.BruceWillis);
|
||||
TvCredits item = await TMDbClient.GetPersonTvCreditsAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.NotNull(item.Cast);
|
||||
@ -138,7 +138,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestPersonsGetPersonMovieCreditsAsync()
|
||||
{
|
||||
MovieCredits item = await Config.Client.GetPersonMovieCreditsAsync(IdHelper.BruceWillis);
|
||||
MovieCredits item = await TMDbClient.GetPersonMovieCreditsAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.NotNull(item.Cast);
|
||||
@ -173,7 +173,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestPersonsGetPersonExternalIdsAsync()
|
||||
{
|
||||
ExternalIdsPerson item = await Config.Client.GetPersonExternalIdsAsync(IdHelper.BruceWillis);
|
||||
ExternalIdsPerson item = await TMDbClient.GetPersonExternalIdsAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(IdHelper.BruceWillis, item.Id);
|
||||
@ -183,7 +183,7 @@ namespace TMDbLibTests
|
||||
Assert.Equal("10183", item.TvrageId);
|
||||
Assert.Null(item.FacebookId);
|
||||
|
||||
item = await Config.Client.GetPersonExternalIdsAsync(IdHelper.JoshACagan);
|
||||
item = await TMDbClient.GetPersonExternalIdsAsync(IdHelper.JoshACagan);
|
||||
|
||||
Assert.NotNull(item);
|
||||
Assert.Equal(IdHelper.JoshACagan, item.Id);
|
||||
@ -196,10 +196,10 @@ namespace TMDbLibTests
|
||||
public async Task TestPersonsGetPersonCreditsAsync()
|
||||
{
|
||||
//GetPersonCredits(int id, string language)
|
||||
MovieCredits resp = await Config.Client.GetPersonMovieCreditsAsync(IdHelper.BruceWillis);
|
||||
MovieCredits resp = await TMDbClient.GetPersonMovieCreditsAsync(IdHelper.BruceWillis);
|
||||
Assert.NotNull(resp);
|
||||
|
||||
MovieCredits respItalian = await Config.Client.GetPersonMovieCreditsAsync(IdHelper.BruceWillis, "it");
|
||||
MovieCredits respItalian = await TMDbClient.GetPersonMovieCreditsAsync(IdHelper.BruceWillis, "it");
|
||||
Assert.NotNull(respItalian);
|
||||
|
||||
Assert.Equal(resp.Cast.Count, respItalian.Cast.Count);
|
||||
@ -233,13 +233,13 @@ namespace TMDbLibTests
|
||||
public async Task TestPersonsGetPersonChangesAsync()
|
||||
{
|
||||
// FindAsync latest changed person
|
||||
SearchContainer<ChangesListItem> latestChanges = await Config.Client.GetChangesPeopleAsync();
|
||||
SearchContainer<ChangesListItem> latestChanges = await TMDbClient.GetChangesPeopleAsync();
|
||||
int latestChanged = latestChanges.Results.Last().Id;
|
||||
|
||||
// Fetch changelog
|
||||
DateTime lower = DateTime.UtcNow.AddDays(-14);
|
||||
DateTime higher = DateTime.UtcNow;
|
||||
List<Change> respRange = await Config.Client.GetPersonChangesAsync(latestChanged, lower, higher);
|
||||
List<Change> respRange = await TMDbClient.GetPersonChangesAsync(latestChanged, lower, higher);
|
||||
|
||||
Assert.NotNull(respRange);
|
||||
Assert.True(respRange.Count > 0);
|
||||
@ -261,17 +261,17 @@ namespace TMDbLibTests
|
||||
public async Task TestPersonsImagesAsync()
|
||||
{
|
||||
// Get config
|
||||
await Config.Client.GetConfigAsync();
|
||||
await TMDbClient.GetConfigAsync();
|
||||
|
||||
// Get images
|
||||
ProfileImages images = await Config.Client.GetPersonImagesAsync(IdHelper.BruceWillis);
|
||||
ProfileImages images = await TMDbClient.GetPersonImagesAsync(IdHelper.BruceWillis);
|
||||
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Profiles);
|
||||
Assert.Equal(IdHelper.BruceWillis, images.Id);
|
||||
|
||||
// Test image url generator
|
||||
await TestImagesHelpers.TestImagesAsync(Config, images);
|
||||
await TestImagesHelpers.TestImagesAsync(TestConfig, images);
|
||||
|
||||
ImageData image = images.Profiles.SingleOrDefault(s => s.FilePath == "/kI1OluWhLJk3pnR19VjOfABpnTY.jpg");
|
||||
|
||||
@ -289,12 +289,12 @@ namespace TMDbLibTests
|
||||
public async Task TestPersonsTaggedImagesAsync()
|
||||
{
|
||||
// Get config
|
||||
await Config.Client.GetConfigAsync();
|
||||
await TMDbClient.GetConfigAsync();
|
||||
|
||||
// Get images
|
||||
await TestHelpers.SearchPagesAsync<SearchContainerWithId<TaggedImage>, TaggedImage>(i => Config.Client.GetPersonTaggedImagesAsync(IdHelper.BruceWillis, i));
|
||||
await TestHelpers.SearchPagesAsync<SearchContainerWithId<TaggedImage>, TaggedImage>(i => TMDbClient.GetPersonTaggedImagesAsync(IdHelper.BruceWillis, i));
|
||||
|
||||
SearchContainer<TaggedImage> images = await Config.Client.GetPersonTaggedImagesAsync(IdHelper.BruceWillis, 1);
|
||||
SearchContainer<TaggedImage> images = await TMDbClient.GetPersonTaggedImagesAsync(IdHelper.BruceWillis, 1);
|
||||
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Results);
|
||||
@ -343,19 +343,19 @@ namespace TMDbLibTests
|
||||
{
|
||||
foreach (PersonListType type in Enum.GetValues(typeof(PersonListType)).OfType<PersonListType>())
|
||||
{
|
||||
SearchContainer<PersonResult> list = await Config.Client.GetPersonListAsync(type);
|
||||
SearchContainer<PersonResult> list = await TMDbClient.GetPersonListAsync(type);
|
||||
|
||||
Assert.NotNull(list);
|
||||
Assert.True(list.Results.Count > 0);
|
||||
Assert.Equal(1, list.Page);
|
||||
|
||||
SearchContainer<PersonResult> listPage2 = await Config.Client.GetPersonListAsync(type, 2);
|
||||
SearchContainer<PersonResult> listPage2 = await TMDbClient.GetPersonListAsync(type, 2);
|
||||
|
||||
Assert.NotNull(listPage2);
|
||||
Assert.True(listPage2.Results.Count > 0);
|
||||
Assert.Equal(2, listPage2.Page);
|
||||
|
||||
SearchContainer<PersonResult> list2 = await Config.Client.GetPersonListAsync(type);
|
||||
SearchContainer<PersonResult> list2 = await TMDbClient.GetPersonListAsync(type);
|
||||
|
||||
Assert.NotNull(list2);
|
||||
Assert.True(list2.Results.Count > 0);
|
||||
@ -369,14 +369,14 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestGetLatestPersonAsync()
|
||||
{
|
||||
Person item = await Config.Client.GetLatestPersonAsync();
|
||||
Person item = await TMDbClient.GetLatestPersonAsync();
|
||||
Assert.NotNull(item);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestGetTranslatedPersonAsync()
|
||||
{
|
||||
Person person = await Config.Client.GetPersonAsync(1019, "da");
|
||||
Person person = await TMDbClient.GetPersonAsync(1019, "da");
|
||||
Assert.NotNull(person);
|
||||
Assert.Equal("Mads Dittmann Mikkelsen, der er søn af fuldmægtig Henning Mikkelsen og hustru sygehjælper Bente Christiansen, voksede op på Nørrebro i København. I 11 år var han gymnast og gymnastikinstruktør i Gymnastikforeningen Gefion. Efter studentereksamen tilmeldte han sig et dansekursus for arbejdsløse. Det blev siden til otte års professionelt engagement i danseensemblet Mikado og han var to gange på Martha Grahams sommerskole i New York. Senere blev han også vikar for Vicky Leander på Daghøjskolen for dansk, drama og musik. Han blev skuespilleruddannet fra Århus Teaterskole i 1996 og debuterede som førsteelsker i \"Kunst\" på Århus Teater. Mads Mikkelsen har bl.a. stået på scenen i \"Paradis\" (1997), \"Længe siden\" (1999) og \"Fiaskospiralen\" (1999) på Dr. Dante’s Aveny samt \"Romeo og Julie\" (1998) på Østre Gasværk. Han filmdebuterede allerede i 1995 med en af hovedrollerne i novellefilmen \"Blomsterfangen\" I 1996 fik han sit store kunstneriske filmgennembrud som den kronragede slyngel Tonny i den banebrydende og meget rå film \"Pusher\". Han havde den ene af hovedrollerne i den danske film \"Vildspor\", rollen som Lenny i \"Bleeder\" og huskes som den våbengale Arne i Anders Thomas Jensens første spillefilm \"Blinkende Lygter\" (2000), der blev det helt store biografhit. I 2001 fik han også fænomenal succes i Hella Joofs biograffilm \"En kort, en lang\", hvor han spillede bøssen Jacob over for Troels Lyby. Siden 2005 har han haft international succes i film som \"King Arthur\" og især som storskurken Le Chiffre i James Bond- filmen \"Casino Royale\" fra 2006. I DR\'s politiserie \"Rejseholdet\" fik han sit folkelige gennembrud som politimanden Allan Fischer. Han er bror til skuespilleren Lars Mikkelsen. Mads Mikkelsen blev den 2. december 2000 gift med danserinde og koreograf Hanne Jacobsen (13-01-1961) og sammen har de to børn.", person.Biography);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestReviewFullDetails()
|
||||
{
|
||||
Review review = await Config.Client.GetReviewAsync(IdHelper.TheDarkKnightRisesReviewId);
|
||||
Review review = await TMDbClient.GetReviewAsync(IdHelper.TheDarkKnightRisesReviewId);
|
||||
|
||||
Assert.NotNull(review);
|
||||
|
||||
@ -28,7 +28,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestReviewMissing()
|
||||
{
|
||||
Review review = await Config.Client.GetReviewAsync(IdHelper.MissingID.ToString());
|
||||
Review review = await TMDbClient.GetReviewAsync(IdHelper.MissingID.ToString());
|
||||
|
||||
Assert.Null(review);
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestSearchMovieAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.SearchMovieAsync("007", i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchMovieAsync("007", i));
|
||||
|
||||
// Search pr. Year
|
||||
// 1962: First James Bond movie, "Dr. No"
|
||||
SearchContainer<SearchMovie> result = await Config.Client.SearchMovieAsync("007", year: 1962);
|
||||
SearchContainer<SearchMovie> result = await TMDbClient.SearchMovieAsync("007", year: 1962);
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchMovie item = result.Results.SingleOrDefault(s => s.Id == 646);
|
||||
@ -47,9 +47,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestSearchCollectionAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.SearchCollectionAsync("007", i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchCollectionAsync("007", i));
|
||||
|
||||
SearchContainer<SearchCollection> result = await Config.Client.SearchCollectionAsync("James Bond");
|
||||
SearchContainer<SearchCollection> result = await TMDbClient.SearchCollectionAsync("James Bond");
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchCollection item = result.Results.SingleOrDefault(s => s.Id == 645);
|
||||
@ -64,9 +64,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestSearchPersonAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.SearchPersonAsync("Willis", i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchPersonAsync("Willis", i));
|
||||
|
||||
SearchContainer<SearchPerson> result = await Config.Client.SearchPersonAsync("Willis");
|
||||
SearchContainer<SearchPerson> result = await TMDbClient.SearchPersonAsync("Willis");
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchPerson item = result.Results.SingleOrDefault(s => s.Id == 62);
|
||||
@ -85,9 +85,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestSearchListAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.SearchListAsync("to watch", i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchListAsync("to watch", i));
|
||||
|
||||
SearchContainer<SearchList> result = await Config.Client.SearchListAsync("to watch");
|
||||
SearchContainer<SearchList> result = await TMDbClient.SearchListAsync("to watch");
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchList item = result.Results.SingleOrDefault(s => s.Id == "54a5c0ceaed56c28c300013a");
|
||||
@ -106,9 +106,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestSearchCompanyAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.SearchCompanyAsync("20th", i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchCompanyAsync("20th", i));
|
||||
|
||||
SearchContainer<SearchCompany> result = await Config.Client.SearchCompanyAsync("20th");
|
||||
SearchContainer<SearchCompany> result = await TMDbClient.SearchCompanyAsync("20th");
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchCompany item = result.Results.SingleOrDefault(s => s.Id == 25);
|
||||
@ -122,9 +122,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestSearchKeywordAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.SearchKeywordAsync("plot", i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchKeywordAsync("plot", i));
|
||||
|
||||
SearchContainer<SearchKeyword> result = await Config.Client.SearchKeywordAsync("plot");
|
||||
SearchContainer<SearchKeyword> result = await TMDbClient.SearchKeywordAsync("plot");
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchKeyword item = result.Results.SingleOrDefault(s => s.Id == 11121);
|
||||
@ -137,9 +137,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestSearchTvShowAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.SearchTvShowAsync("Breaking Bad", i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchTvShowAsync("Breaking Bad", i));
|
||||
|
||||
SearchContainer<SearchTv> result = await Config.Client.SearchTvShowAsync("Breaking Bad");
|
||||
SearchContainer<SearchTv> result = await TMDbClient.SearchTvShowAsync("Breaking Bad");
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchTv item = result.Results.SingleOrDefault(s => s.Id == 1396);
|
||||
@ -169,9 +169,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestSearchMultiAsync()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.SearchMultiAsync("Arrow", i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchMultiAsync("Arrow", i));
|
||||
|
||||
SearchContainer<SearchBase> result = await Config.Client.SearchMultiAsync("Arrow");
|
||||
SearchContainer<SearchBase> result = await TMDbClient.SearchMultiAsync("Arrow");
|
||||
|
||||
Assert.True(result.Results.Any());
|
||||
SearchTv item = result.Results.OfType<SearchTv>().SingleOrDefault(s => s.Id == 1412);
|
||||
|
@ -15,11 +15,11 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task GetConfigTest()
|
||||
{
|
||||
Assert.False(Config.Client.HasConfig);
|
||||
await Config.Client.GetConfigAsync();
|
||||
Assert.True(Config.Client.HasConfig);
|
||||
Assert.False(TMDbClient.HasConfig);
|
||||
await TMDbClient.GetConfigAsync();
|
||||
Assert.True(TMDbClient.HasConfig);
|
||||
|
||||
Assert.NotNull(Config.Client.Config);
|
||||
Assert.NotNull(TMDbClient.Config);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -37,7 +37,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public void GetConfigFailTest()
|
||||
{
|
||||
Assert.Throws<InvalidOperationException>(() => Config.Client.Config);
|
||||
Assert.Throws<InvalidOperationException>(() => TMDbClient.Config);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -49,11 +49,11 @@ namespace TMDbLibTests
|
||||
config.Images = new ConfigImageTypes();
|
||||
config.Images.BaseUrl = " ..";
|
||||
|
||||
Assert.False(Config.Client.HasConfig);
|
||||
Config.Client.SetConfig(config);
|
||||
Assert.True(Config.Client.HasConfig);
|
||||
Assert.False(TMDbClient.HasConfig);
|
||||
TMDbClient.SetConfig(config);
|
||||
Assert.True(TMDbClient.HasConfig);
|
||||
|
||||
Assert.Same(config, Config.Client.Config);
|
||||
Assert.Same(config, TMDbClient.Config);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -12,21 +12,21 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTrendingMoviesAsync()
|
||||
{
|
||||
SearchContainer<SearchMovie> movies = await Config.Client.GetTrendingMoviesAsync(TimeWindow.Week);
|
||||
SearchContainer<SearchMovie> movies = await TMDbClient.GetTrendingMoviesAsync(TimeWindow.Week);
|
||||
Assert.True(movies.Results.Count > 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTrendingTvAsync()
|
||||
{
|
||||
SearchContainer<SearchTv> tv = await Config.Client.GetTrendingTvAsync(TimeWindow.Week);
|
||||
SearchContainer<SearchTv> tv = await TMDbClient.GetTrendingTvAsync(TimeWindow.Week);
|
||||
Assert.True(tv.Results.Count > 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTrendingPeopleAsync()
|
||||
{
|
||||
SearchContainer<SearchPerson> people = await Config.Client.GetTrendingPeopleAsync(TimeWindow.Week);
|
||||
SearchContainer<SearchPerson> people = await TMDbClient.GetTrendingPeopleAsync(TimeWindow.Week);
|
||||
Assert.True(people.Results.Count > 0);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public void TestTvEpisodeGroups()
|
||||
{
|
||||
Task<TvGroupCollection> group = Config.Client.GetTvEpisodeGroupsAsync("5acf93e60e0a26346d0000ce");
|
||||
Task<TvGroupCollection> group = TMDbClient.GetTvEpisodeGroupsAsync("5acf93e60e0a26346d0000ce");
|
||||
|
||||
Assert.Equal("5acf93e60e0a26346d0000ce", group.Result.Id);
|
||||
Assert.Equal("Netflix Collections", group.Result.Name);
|
||||
|
@ -33,7 +33,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeExtrasNoneAsync()
|
||||
{
|
||||
TvEpisode tvEpisode = await Config.Client.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1);
|
||||
TvEpisode tvEpisode = await TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1);
|
||||
|
||||
TestBreakingBadSeasonOneEpisodeOneBaseProperties(tvEpisode);
|
||||
|
||||
@ -48,17 +48,17 @@ namespace TMDbLibTests
|
||||
public async Task TestTvEpisodeExtrasAccountState()
|
||||
{
|
||||
// Test the custom parsing code for Account State rating
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
TvEpisode episode = await Config.Client.GetTvEpisodeAsync(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates);
|
||||
TvEpisode episode = await TMDbClient.GetTvEpisodeAsync(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates);
|
||||
if (episode.AccountStates == null || !episode.AccountStates.Rating.HasValue)
|
||||
{
|
||||
await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 5);
|
||||
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 5);
|
||||
|
||||
// Allow TMDb to update cache
|
||||
Thread.Sleep(2000);
|
||||
|
||||
episode = await Config.Client.GetTvEpisodeAsync(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates);
|
||||
episode = await TMDbClient.GetTvEpisodeAsync(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates);
|
||||
}
|
||||
|
||||
Assert.NotNull(episode.AccountStates);
|
||||
@ -69,12 +69,12 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeExtrasAll()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Account states will only show up if we've done something
|
||||
await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5);
|
||||
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => Config.Client.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, combined),
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, combined),
|
||||
tvEpisode =>
|
||||
{
|
||||
TestBreakingBadSeasonOneEpisodeOneBaseProperties(tvEpisode);
|
||||
@ -88,14 +88,14 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeExtrasExclusiveAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => Config.Client.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, extras));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeSeparateExtrasCreditsAsync()
|
||||
{
|
||||
CreditsWithGuestStars credits = await Config.Client.GetTvEpisodeCreditsAsync(IdHelper.BreakingBad, 1, 1);
|
||||
CreditsWithGuestStars credits = await TMDbClient.GetTvEpisodeCreditsAsync(IdHelper.BreakingBad, 1, 1);
|
||||
Assert.NotNull(credits);
|
||||
|
||||
Cast guestStarItem = credits.GuestStars.FirstOrDefault(s => s.Id == 92495);
|
||||
@ -126,7 +126,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeSeparateExtrasExternalIdsAsync()
|
||||
{
|
||||
ExternalIdsTvEpisode externalIds = await Config.Client.GetTvEpisodeExternalIdsAsync(IdHelper.BreakingBad, 1, 1);
|
||||
ExternalIdsTvEpisode externalIds = await TMDbClient.GetTvEpisodeExternalIdsAsync(IdHelper.BreakingBad, 1, 1);
|
||||
|
||||
Assert.NotNull(externalIds);
|
||||
Assert.True(string.IsNullOrEmpty(externalIds.FreebaseId));
|
||||
@ -140,7 +140,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeSeparateExtrasImagesAsync()
|
||||
{
|
||||
StillImages images = await Config.Client.GetTvEpisodeImagesAsync(IdHelper.BreakingBad, 1, 1);
|
||||
StillImages images = await TMDbClient.GetTvEpisodeImagesAsync(IdHelper.BreakingBad, 1, 1);
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Stills);
|
||||
}
|
||||
@ -148,7 +148,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeSeparateExtrasVideosAsync()
|
||||
{
|
||||
ResultContainer<Video> images = await Config.Client.GetTvEpisodeVideosAsync(IdHelper.BreakingBad, 1, 1);
|
||||
ResultContainer<Video> images = await TMDbClient.GetTvEpisodeVideosAsync(IdHelper.BreakingBad, 1, 1);
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Results);
|
||||
}
|
||||
@ -156,53 +156,53 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeAccountStateRatingSetAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
TvEpisodeAccountState accountState = await Config.Client.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
TvEpisodeAccountState accountState = await TMDbClient.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1);
|
||||
|
||||
// Remove the rating
|
||||
if (accountState.Rating.HasValue)
|
||||
{
|
||||
Assert.True(await Config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
|
||||
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
|
||||
// Test that the episode is NOT rated
|
||||
accountState = await Config.Client.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1);
|
||||
accountState = await TMDbClient.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1);
|
||||
|
||||
Assert.Equal(IdHelper.BreakingBadSeason1Episode1Id, accountState.Id);
|
||||
Assert.False(accountState.Rating.HasValue);
|
||||
|
||||
// Rate the episode
|
||||
Assert.True(await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5));
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the episode IS rated
|
||||
accountState = await Config.Client.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1);
|
||||
accountState = await TMDbClient.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1);
|
||||
Assert.Equal(IdHelper.BreakingBadSeason1Episode1Id, accountState.Id);
|
||||
Assert.True(accountState.Rating.HasValue);
|
||||
|
||||
// Remove the rating
|
||||
Assert.True(await Config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
|
||||
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeRateBadAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
Assert.False(await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, -1));
|
||||
Assert.False(await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 0));
|
||||
Assert.False(await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 10.5));
|
||||
Assert.False(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, -1));
|
||||
Assert.False(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 0));
|
||||
Assert.False(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 10.5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeGetChangesAsync()
|
||||
{
|
||||
ChangesContainer changes = await Config.Client.GetTvEpisodeChangesAsync(IdHelper.BreakingBadSeason1Episode1Id);
|
||||
ChangesContainer changes = await TMDbClient.GetTvEpisodeChangesAsync(IdHelper.BreakingBadSeason1Episode1Id);
|
||||
|
||||
Assert.NotNull(changes);
|
||||
Assert.NotNull(changes.Changes);
|
||||
@ -246,7 +246,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeMissingAsync()
|
||||
{
|
||||
TvEpisode tvEpisode = await Config.Client.GetTvEpisodeAsync(IdHelper.MissingID, 1, 1);
|
||||
TvEpisode tvEpisode = await TMDbClient.GetTvEpisodeAsync(IdHelper.MissingID, 1, 1);
|
||||
|
||||
Assert.Null(tvEpisode);
|
||||
}
|
||||
@ -254,7 +254,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodesScreenedTheatricallyAsync()
|
||||
{
|
||||
ResultContainer<TvEpisodeInfo> results = await Config.Client.GetTvEpisodesScreenedTheatricallyAsync(IdHelper.GameOfThrones);
|
||||
ResultContainer<TvEpisodeInfo> results = await TMDbClient.GetTvEpisodesScreenedTheatricallyAsync(IdHelper.GameOfThrones);
|
||||
|
||||
Assert.Equal(IdHelper.GameOfThrones, results.Id);
|
||||
|
||||
@ -267,7 +267,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvEpisodeGetTvEpisodeWithImageLanguageAsync()
|
||||
{
|
||||
TvEpisode resp = await Config.Client.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, language: "en-US", includeImageLanguage: "en", extraMethods: TvEpisodeMethods.Images);
|
||||
TvEpisode resp = await TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, language: "en-US", includeImageLanguage: "en", extraMethods: TvEpisodeMethods.Images);
|
||||
|
||||
Assert.True(resp.Images.Stills.Count > 0);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSeasonExtrasNoneAsync()
|
||||
{
|
||||
TvSeason tvSeason = await Config.Client.GetTvSeasonAsync(IdHelper.BreakingBad, 1);
|
||||
TvSeason tvSeason = await TMDbClient.GetTvSeasonAsync(IdHelper.BreakingBad, 1);
|
||||
|
||||
TestBreakingBadBaseProperties(tvSeason);
|
||||
|
||||
@ -49,17 +49,17 @@ namespace TMDbLibTests
|
||||
public async Task TestTvSeasonExtrasAccountState()
|
||||
{
|
||||
// Test the custom parsing code for Account State rating
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
TvSeason season = await Config.Client.GetTvSeasonAsync(IdHelper.BigBangTheory, 1, TvSeasonMethods.AccountStates);
|
||||
TvSeason season = await TMDbClient.GetTvSeasonAsync(IdHelper.BigBangTheory, 1, TvSeasonMethods.AccountStates);
|
||||
if (season.AccountStates == null || season.AccountStates.Results.All(s => s.EpisodeNumber != 1))
|
||||
{
|
||||
await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 5);
|
||||
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 5);
|
||||
|
||||
// Allow TMDb to update cache
|
||||
Thread.Sleep(2000);
|
||||
|
||||
season = await Config.Client.GetTvSeasonAsync(IdHelper.BigBangTheory, 1, TvSeasonMethods.AccountStates);
|
||||
season = await TMDbClient.GetTvSeasonAsync(IdHelper.BigBangTheory, 1, TvSeasonMethods.AccountStates);
|
||||
}
|
||||
|
||||
Assert.NotNull(season.AccountStates);
|
||||
@ -70,25 +70,25 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSeasonExtrasAllAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Account states will only show up if we've done something
|
||||
await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5);
|
||||
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => Config.Client.GetTvSeasonAsync(IdHelper.BreakingBad, 1, combined), TestBreakingBadBaseProperties);
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetTvSeasonAsync(IdHelper.BreakingBad, 1, combined), TestBreakingBadBaseProperties);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvSeasonExtrasExclusiveAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => Config.Client.GetTvSeasonAsync(IdHelper.BreakingBad, 1, extras));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
await TestMethodsHelper.TestGetExclusive(_methods, extras => TMDbClient.GetTvSeasonAsync(IdHelper.BreakingBad, 1, extras));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvSeasonSeparateExtrasCreditsAsync()
|
||||
{
|
||||
Credits credits = await Config.Client.GetTvSeasonCreditsAsync(IdHelper.BreakingBad, 1);
|
||||
Credits credits = await TMDbClient.GetTvSeasonCreditsAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(credits);
|
||||
Assert.NotNull(credits.Cast);
|
||||
Assert.Equal("Walter White", credits.Cast[0].Character);
|
||||
@ -114,7 +114,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSeasonSeparateExtrasExternalIdsAsync()
|
||||
{
|
||||
ExternalIdsTvSeason externalIds = await Config.Client.GetTvSeasonExternalIdsAsync(IdHelper.BreakingBad, 1);
|
||||
ExternalIdsTvSeason externalIds = await TMDbClient.GetTvSeasonExternalIdsAsync(IdHelper.BreakingBad, 1);
|
||||
|
||||
Assert.NotNull(externalIds);
|
||||
Assert.Equal(3572, externalIds.Id);
|
||||
@ -127,7 +127,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSeasonSeparateExtrasImagesAsync()
|
||||
{
|
||||
PosterImages images = await Config.Client.GetTvSeasonImagesAsync(IdHelper.BreakingBad, 1);
|
||||
PosterImages images = await TMDbClient.GetTvSeasonImagesAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Posters);
|
||||
}
|
||||
@ -135,7 +135,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSeasonSeparateExtrasVideosAsync()
|
||||
{
|
||||
ResultContainer<Video> videos = await Config.Client.GetTvSeasonVideosAsync(IdHelper.BreakingBad, 1);
|
||||
ResultContainer<Video> videos = await TMDbClient.GetTvSeasonVideosAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(videos);
|
||||
Assert.NotNull(videos.Results);
|
||||
}
|
||||
@ -143,18 +143,18 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSeasonAccountStateRatingSetAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Rate episode 1, 2 and 3 of BreakingBad
|
||||
Assert.True(await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5));
|
||||
Assert.True(await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 2, 7));
|
||||
Assert.True(await Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 3, 3));
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5));
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 2, 7));
|
||||
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 3, 3));
|
||||
|
||||
// Wait for TMDb to un-cache our value
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Fetch out the seasons state
|
||||
ResultContainer<TvEpisodeAccountStateWithNumber> state = await Config.Client.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1);
|
||||
ResultContainer<TvEpisodeAccountStateWithNumber> state = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(state);
|
||||
|
||||
Assert.True(Math.Abs(5 - (state.Results.Single(s => s.EpisodeNumber == 1).Rating ?? 0)) < double.Epsilon);
|
||||
@ -162,14 +162,14 @@ namespace TMDbLibTests
|
||||
Assert.True(Math.Abs(3 - (state.Results.Single(s => s.EpisodeNumber == 3).Rating ?? 0)) < double.Epsilon);
|
||||
|
||||
// Test deleting Ratings
|
||||
Assert.True(await Config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
|
||||
Assert.True(await Config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 2));
|
||||
Assert.True(await Config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 3));
|
||||
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
|
||||
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 2));
|
||||
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 3));
|
||||
|
||||
// Wait for TMDb to un-cache our value
|
||||
Thread.Sleep(2000);
|
||||
|
||||
state = await Config.Client.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1);
|
||||
state = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1);
|
||||
Assert.NotNull(state);
|
||||
|
||||
Assert.Null(state.Results.Single(s => s.EpisodeNumber == 1).Rating);
|
||||
@ -180,7 +180,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSeasonGetChangesAsync()
|
||||
{
|
||||
ChangesContainer changes = await Config.Client.GetTvSeasonChangesAsync(IdHelper.BreakingBadSeason1Id);
|
||||
ChangesContainer changes = await TMDbClient.GetTvSeasonChangesAsync(IdHelper.BreakingBadSeason1Id);
|
||||
Assert.NotNull(changes);
|
||||
Assert.NotNull(changes.Changes);
|
||||
}
|
||||
@ -208,7 +208,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSeasonMissingAsync()
|
||||
{
|
||||
TvSeason tvSeason = await Config.Client.GetTvSeasonAsync(IdHelper.MissingID, 1);
|
||||
TvSeason tvSeason = await TMDbClient.GetTvSeasonAsync(IdHelper.MissingID, 1);
|
||||
|
||||
Assert.Null(tvSeason);
|
||||
}
|
||||
@ -216,7 +216,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvSeasonGetTvSeasonWithImageLanguageAsync()
|
||||
{
|
||||
TvSeason resp = await Config.Client.GetTvSeasonAsync(IdHelper.BreakingBad, 1, language: "en-US", includeImageLanguage: "en", extraMethods: TvSeasonMethods.Images);
|
||||
TvSeason resp = await TMDbClient.GetTvSeasonAsync(IdHelper.BreakingBad, 1, language: "en-US", includeImageLanguage: "en", extraMethods: TvSeasonMethods.Images);
|
||||
|
||||
Assert.True(resp.Images.Posters.Count > 0);
|
||||
Assert.True(resp.Images.Posters.All(p => p.Iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase)));
|
||||
|
@ -41,7 +41,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowExtrasNoneAsync()
|
||||
{
|
||||
TvShow tvShow = await Config.Client.GetTvShowAsync(IdHelper.BreakingBad);
|
||||
TvShow tvShow = await TMDbClient.GetTvShowAsync(IdHelper.BreakingBad);
|
||||
|
||||
TestBreakingBadBaseProperties(tvShow);
|
||||
|
||||
@ -53,18 +53,18 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowExtrasAllAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
// Account states will only show up if we've done something
|
||||
await Config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => Config.Client.GetTvShowAsync(IdHelper.BreakingBad, combined), TestBreakingBadBaseProperties);
|
||||
await TestMethodsHelper.TestGetAll(_methods, combined => TMDbClient.GetTvShowAsync(IdHelper.BreakingBad, combined), TestBreakingBadBaseProperties);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasCreditsAsync()
|
||||
{
|
||||
Credits credits = await Config.Client.GetTvShowCreditsAsync(IdHelper.BreakingBad);
|
||||
Credits credits = await TMDbClient.GetTvShowCreditsAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.NotNull(credits);
|
||||
Assert.NotNull(credits.Cast);
|
||||
@ -97,7 +97,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasExternalIdsAsync()
|
||||
{
|
||||
ExternalIdsTvShow externalIds = await Config.Client.GetTvShowExternalIdsAsync(IdHelper.GameOfThrones);
|
||||
ExternalIdsTvShow externalIds = await TMDbClient.GetTvShowExternalIdsAsync(IdHelper.GameOfThrones);
|
||||
|
||||
Assert.NotNull(externalIds);
|
||||
Assert.Equal(1399, externalIds.Id);
|
||||
@ -114,7 +114,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasContentRatingsAsync()
|
||||
{
|
||||
ResultContainer<ContentRating> contentRatings = await Config.Client.GetTvShowContentRatingsAsync(IdHelper.BreakingBad);
|
||||
ResultContainer<ContentRating> contentRatings = await TMDbClient.GetTvShowContentRatingsAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(contentRatings);
|
||||
Assert.Equal(IdHelper.BreakingBad, contentRatings.Id);
|
||||
|
||||
@ -126,7 +126,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasAlternativeTitlesAsync()
|
||||
{
|
||||
ResultContainer<AlternativeTitle> alternativeTitles = await Config.Client.GetTvShowAlternativeTitlesAsync(IdHelper.BreakingBad);
|
||||
ResultContainer<AlternativeTitle> alternativeTitles = await TMDbClient.GetTvShowAlternativeTitlesAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(alternativeTitles);
|
||||
Assert.Equal(IdHelper.BreakingBad, alternativeTitles.Id);
|
||||
|
||||
@ -138,7 +138,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasKeywordsAsync()
|
||||
{
|
||||
ResultContainer<Keyword> keywords = await Config.Client.GetTvShowKeywordsAsync(IdHelper.BreakingBad);
|
||||
ResultContainer<Keyword> keywords = await TMDbClient.GetTvShowKeywordsAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(keywords);
|
||||
Assert.Equal(IdHelper.BreakingBad, keywords.Id);
|
||||
|
||||
@ -150,7 +150,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasTranslationsAsync()
|
||||
{
|
||||
TranslationsContainerTv translations = await Config.Client.GetTvShowTranslationsAsync(IdHelper.BreakingBad);
|
||||
TranslationsContainerTv translations = await TMDbClient.GetTvShowTranslationsAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(translations);
|
||||
Assert.Equal(IdHelper.BreakingBad, translations.Id);
|
||||
|
||||
@ -164,7 +164,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasVideosAsync()
|
||||
{
|
||||
ResultContainer<Video> videos = await Config.Client.GetTvShowVideosAsync(IdHelper.BreakingBad);
|
||||
ResultContainer<Video> videos = await TMDbClient.GetTvShowVideosAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(videos);
|
||||
Assert.Equal(IdHelper.BreakingBad, videos.Id);
|
||||
|
||||
@ -184,17 +184,17 @@ namespace TMDbLibTests
|
||||
public async Task TestTvShowSeparateExtrasAccountStateAsync()
|
||||
{
|
||||
// Test the custom parsing code for Account State rating
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
|
||||
TvShow show = await Config.Client.GetTvShowAsync(IdHelper.BigBangTheory, TvShowMethods.AccountStates);
|
||||
TvShow show = await TMDbClient.GetTvShowAsync(IdHelper.BigBangTheory, TvShowMethods.AccountStates);
|
||||
if (show.AccountStates == null || !show.AccountStates.Rating.HasValue)
|
||||
{
|
||||
await Config.Client.TvShowSetRatingAsync(IdHelper.BigBangTheory, 5);
|
||||
await TMDbClient.TvShowSetRatingAsync(IdHelper.BigBangTheory, 5);
|
||||
|
||||
// Allow TMDb to update cache
|
||||
Thread.Sleep(2000);
|
||||
|
||||
show = await Config.Client.GetTvShowAsync(IdHelper.BigBangTheory, TvShowMethods.AccountStates);
|
||||
show = await TMDbClient.GetTvShowAsync(IdHelper.BigBangTheory, TvShowMethods.AccountStates);
|
||||
}
|
||||
|
||||
Assert.NotNull(show.AccountStates);
|
||||
@ -205,7 +205,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSeparateExtrasImagesAsync()
|
||||
{
|
||||
ImagesWithId images = await Config.Client.GetTvShowImagesAsync(IdHelper.BreakingBad);
|
||||
ImagesWithId images = await TMDbClient.GetTvShowImagesAsync(IdHelper.BreakingBad);
|
||||
Assert.NotNull(images);
|
||||
Assert.NotNull(images.Backdrops);
|
||||
Assert.NotNull(images.Posters);
|
||||
@ -214,7 +214,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowGetImagesWithImageLanguageAsync()
|
||||
{
|
||||
ImagesWithId resp = await Config.Client.GetTvShowImagesAsync(IdHelper.BreakingBad, language: "en-US", includeImageLanguage: "en");
|
||||
ImagesWithId resp = await TMDbClient.GetTvShowImagesAsync(IdHelper.BreakingBad, language: "en-US", includeImageLanguage: "en");
|
||||
|
||||
Assert.True(resp.Backdrops.Count > 0);
|
||||
Assert.True(resp.Posters.Count > 0);
|
||||
@ -223,7 +223,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowGetTvShowWithImageLanguageAsync()
|
||||
{
|
||||
TvShow resp = await Config.Client.GetTvShowAsync(IdHelper.BreakingBad, language: "en-US", includeImageLanguage: "en", extraMethods: TvShowMethods.Images);
|
||||
TvShow resp = await TMDbClient.GetTvShowAsync(IdHelper.BreakingBad, language: "en-US", includeImageLanguage: "en", extraMethods: TvShowMethods.Images);
|
||||
|
||||
Assert.True(resp.Images.Backdrops.Count > 0);
|
||||
Assert.True(resp.Images.Backdrops.All(b => b.Iso_639_1.Equals("en", StringComparison.OrdinalIgnoreCase)));
|
||||
@ -298,9 +298,9 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowPopular()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.GetTvShowPopularAsync(i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetTvShowPopularAsync(i));
|
||||
|
||||
SearchContainer<SearchTv> result = await Config.Client.GetTvShowPopularAsync();
|
||||
SearchContainer<SearchTv> result = await TMDbClient.GetTvShowPopularAsync();
|
||||
Assert.NotNull(result.Results[0].Name);
|
||||
Assert.NotNull(result.Results[0].OriginalName);
|
||||
Assert.NotNull(result.Results[0].FirstAirDate);
|
||||
@ -311,14 +311,14 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSeasonCountAsync()
|
||||
{
|
||||
TvShow tvShow = await Config.Client.GetTvShowAsync(1668);
|
||||
TvShow tvShow = await TMDbClient.GetTvShowAsync(1668);
|
||||
Assert.Equal(24, tvShow.Seasons[1].EpisodeCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowVideosAsync()
|
||||
{
|
||||
TvShow tvShow = await Config.Client.GetTvShowAsync(1668, TvShowMethods.Videos);
|
||||
TvShow tvShow = await TMDbClient.GetTvShowAsync(1668, TvShowMethods.Videos);
|
||||
Assert.NotNull(tvShow.Videos);
|
||||
Assert.NotNull(tvShow.Videos.Results);
|
||||
Assert.NotNull(tvShow.Videos.Results[0]);
|
||||
@ -335,7 +335,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowGetMovieWatchProviders()
|
||||
{
|
||||
SingleResultContainer<Dictionary<string, WatchProviders>> resp = await Config.Client.GetTvShowWatchProvidersAsync(IdHelper.GameOfThrones);
|
||||
SingleResultContainer<Dictionary<string, WatchProviders>> resp = await TMDbClient.GetTvShowWatchProvidersAsync(IdHelper.GameOfThrones);
|
||||
|
||||
Assert.NotNull(resp);
|
||||
|
||||
@ -348,7 +348,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowTranslationsAsync()
|
||||
{
|
||||
TranslationsContainerTv translations = await Config.Client.GetTvShowTranslationsAsync(1668);
|
||||
TranslationsContainerTv translations = await TMDbClient.GetTvShowTranslationsAsync(1668);
|
||||
|
||||
Assert.Equal(1668, translations.Id);
|
||||
Translation translation = translations.Translations.SingleOrDefault(s => s.Iso_639_1 == "hr");
|
||||
@ -362,7 +362,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowSimilarsAsync()
|
||||
{
|
||||
SearchContainer<SearchTv> tvShow = await Config.Client.GetTvShowSimilarAsync(1668);
|
||||
SearchContainer<SearchTv> tvShow = await TMDbClient.GetTvShowSimilarAsync(1668);
|
||||
|
||||
Assert.NotNull(tvShow);
|
||||
Assert.NotNull(tvShow.Results);
|
||||
@ -390,7 +390,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowRecommendationsAsync()
|
||||
{
|
||||
SearchContainer<SearchTv> tvShow = await Config.Client.GetTvShowRecommendationsAsync(1668);
|
||||
SearchContainer<SearchTv> tvShow = await TMDbClient.GetTvShowRecommendationsAsync(1668);
|
||||
|
||||
Assert.NotNull(tvShow);
|
||||
Assert.NotNull(tvShow.Results);
|
||||
@ -421,9 +421,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.
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.GetTvShowTopRatedAsync(i));
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.GetTvShowTopRatedAsync(i));
|
||||
|
||||
SearchContainer<SearchTv> result = await Config.Client.GetTvShowTopRatedAsync();
|
||||
SearchContainer<SearchTv> result = await TMDbClient.GetTvShowTopRatedAsync();
|
||||
Assert.NotNull(result.Results[0].Name);
|
||||
Assert.NotNull(result.Results[0].OriginalName);
|
||||
Assert.NotNull(result.Results[0].FirstAirDate);
|
||||
@ -434,7 +434,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowLatest()
|
||||
{
|
||||
TvShow tvShow = await Config.Client.GetLatestTvShowAsync();
|
||||
TvShow tvShow = await TMDbClient.GetLatestTvShowAsync();
|
||||
|
||||
Assert.NotNull(tvShow);
|
||||
}
|
||||
@ -442,7 +442,7 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowReviews()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync<SearchContainerWithId<ReviewBase>, ReviewBase>(i => Config.Client.GetTvShowReviewsAsync(IdHelper.BreakingBad, page: i));
|
||||
await TestHelpers.SearchPagesAsync<SearchContainerWithId<ReviewBase>, ReviewBase>(i => TMDbClient.GetTvShowReviewsAsync(IdHelper.BreakingBad, page: i));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -450,37 +450,37 @@ namespace TMDbLibTests
|
||||
{
|
||||
foreach (TvShowListType type in Enum.GetValues(typeof(TvShowListType)).OfType<TvShowListType>())
|
||||
{
|
||||
TestHelpers.SearchPagesAsync(i => Config.Client.GetTvShowListAsync(type, i));
|
||||
TestHelpers.SearchPagesAsync(i => TMDbClient.GetTvShowListAsync(type, i));
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowAccountStateFavoriteSet()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Remove the favourite
|
||||
if (accountState.Favorite)
|
||||
await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false);
|
||||
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie is NOT favourited
|
||||
accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.False(accountState.Favorite);
|
||||
|
||||
// Favourite the movie
|
||||
await Config.Client.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
|
||||
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie IS favourited
|
||||
accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.True(accountState.Favorite);
|
||||
}
|
||||
@ -488,30 +488,30 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowAccountStateWatchlistSet()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Remove the watchlist
|
||||
if (accountState.Watchlist)
|
||||
await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false);
|
||||
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie is NOT watchlisted
|
||||
accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.False(accountState.Watchlist);
|
||||
|
||||
// Watchlist the movie
|
||||
await Config.Client.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
|
||||
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie IS watchlisted
|
||||
accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.True(accountState.Watchlist);
|
||||
}
|
||||
@ -519,13 +519,13 @@ namespace TMDbLibTests
|
||||
[Fact]
|
||||
public async Task TestTvShowAccountStateRatingSet()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Remove the rating
|
||||
if (accountState.Rating.HasValue)
|
||||
{
|
||||
Assert.True(await Config.Client.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
@ -535,100 +535,100 @@ namespace TMDbLibTests
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie is NOT rated
|
||||
accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.False(accountState.Rating.HasValue);
|
||||
|
||||
// Rate the movie
|
||||
await Config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the movie IS rated
|
||||
accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.True(accountState.Rating.HasValue);
|
||||
|
||||
// Remove the rating
|
||||
Assert.True(await Config.Client.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingBadRatingAsync()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await Config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.1));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingRatingOutOfBounds()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await Config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 10.5));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 10.5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingRatingLowerBoundsTest()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await Config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 0));
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
Assert.False(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingUserSession()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
// Remove the rating
|
||||
if (accountState.Rating.HasValue)
|
||||
{
|
||||
Assert.True(await Config.Client.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
}
|
||||
|
||||
// Test that the episode is NOT rated
|
||||
accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.False(accountState.Rating.HasValue);
|
||||
|
||||
// Rate the episode
|
||||
await Config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
|
||||
|
||||
// Allow TMDb to cache our changes
|
||||
Thread.Sleep(2000);
|
||||
|
||||
// Test that the episode IS rated
|
||||
accountState = await Config.Client.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
|
||||
Assert.Equal(IdHelper.BreakingBad, accountState.Id);
|
||||
Assert.True(accountState.Rating.HasValue);
|
||||
|
||||
// Remove the rating
|
||||
Assert.True(await Config.Client.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowSetRatingGuestSession()
|
||||
{
|
||||
// There is no way to validate the change besides the success return of the api call since the guest session doesn't have access to anything else
|
||||
await Config.Client.SetSessionInformationAsync(Config.GuestTestSessionId, SessionType.GuestSession);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession);
|
||||
|
||||
// Try changing the rating
|
||||
Assert.True(await Config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.5));
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 7.5));
|
||||
|
||||
// Try changing it back to the previous rating
|
||||
Assert.True(await Config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 8));
|
||||
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 8));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task TestTvShowMissingAsync()
|
||||
{
|
||||
TvShow tvShow = await Config.Client.GetTvShowAsync(IdHelper.MissingID);
|
||||
TvShow tvShow = await TMDbClient.GetTvShowAsync(IdHelper.MissingID);
|
||||
|
||||
Assert.Null(tvShow);
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
using Newtonsoft.Json;
|
||||
using TMDbLib.Client;
|
||||
|
||||
namespace TMDbLibTests.JsonHelpers
|
||||
{
|
||||
public abstract class TestBase
|
||||
public abstract class TestBase
|
||||
{
|
||||
protected readonly TestConfig Config;
|
||||
protected readonly TestConfig TestConfig;
|
||||
|
||||
protected TMDbClient TMDbClient => TestConfig.Client;
|
||||
|
||||
protected TestBase()
|
||||
{
|
||||
JsonSerializerSettings sett = new JsonSerializerSettings();
|
||||
|
||||
Config = new TestConfig(serializer: JsonSerializer.Create(sett));
|
||||
TestConfig = new TestConfig(serializer: JsonSerializer.Create(sett));
|
||||
}
|
||||
}
|
||||
}
|
@ -53,8 +53,8 @@ namespace TMDbLibTests.UtilityTests
|
||||
[Fact]
|
||||
public async Task TestAccountStateConverterAccountState()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await Config.Client.GetMovieAccountStateAsync(IdHelper.Avatar);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar);
|
||||
|
||||
Assert.Equal(IdHelper.Avatar, accountState.Id);
|
||||
Assert.True(accountState.Favorite);
|
||||
@ -68,8 +68,8 @@ namespace TMDbLibTests.UtilityTests
|
||||
[Fact]
|
||||
public async Task TestAccountStateConverterTvEpisodeAccountState()
|
||||
{
|
||||
await Config.Client.SetSessionInformationAsync(Config.UserSessionId, SessionType.UserSession);
|
||||
ResultContainer<TvEpisodeAccountStateWithNumber> season = await Config.Client.GetTvSeasonAccountStateAsync(IdHelper.BigBangTheory, 1);
|
||||
await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);
|
||||
ResultContainer<TvEpisodeAccountStateWithNumber> season = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BigBangTheory, 1);
|
||||
|
||||
// Episode 1 has a rating
|
||||
TvEpisodeAccountStateWithNumber episode = season.Results.FirstOrDefault(s => s.EpisodeNumber == 1);
|
||||
|
@ -90,8 +90,8 @@ namespace TMDbLibTests.UtilityTests
|
||||
[Fact]
|
||||
public async Task TestChangeItemConverter()
|
||||
{
|
||||
Movie latestMovie = await Config.Client.GetMovieLatestAsync();
|
||||
List<Change> changes = await Config.Client.GetMovieChangesAsync(latestMovie.Id);
|
||||
Movie latestMovie = await TMDbClient.GetMovieLatestAsync();
|
||||
List<Change> changes = await TMDbClient.GetMovieChangesAsync(latestMovie.Id);
|
||||
List<ChangeItemBase> changeItems = changes.SelectMany(s => s.Items).ToList();
|
||||
|
||||
ChangeAction[] actions = { ChangeAction.Added, ChangeAction.Created, ChangeAction.Updated };
|
||||
|
@ -32,7 +32,7 @@ namespace TMDbLibTests.UtilityTests
|
||||
[Fact]
|
||||
public async Task TestCustomDatetimeFormatConverter()
|
||||
{
|
||||
Token token = await Config.Client.AuthenticationRequestAutenticationTokenAsync();
|
||||
Token token = await TMDbClient.AuthenticationRequestAutenticationTokenAsync();
|
||||
|
||||
DateTime low = DateTime.UtcNow.AddHours(-2);
|
||||
DateTime high = DateTime.UtcNow.AddHours(2);
|
||||
|
@ -52,7 +52,7 @@ namespace TMDbLibTests.UtilityTests
|
||||
[Fact]
|
||||
public async Task TestJsonKnownForConverter()
|
||||
{
|
||||
SearchContainer<SearchPerson> result = await Config.Client.SearchPersonAsync("Willis");
|
||||
SearchContainer<SearchPerson> result = await TMDbClient.SearchPersonAsync("Willis");
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
|
@ -68,8 +68,8 @@ namespace TMDbLibTests.UtilityTests
|
||||
[Fact]
|
||||
public async Task TestSearchBaseConverter()
|
||||
{
|
||||
await TestHelpers.SearchPagesAsync(i => Config.Client.SearchMultiAsync("Jobs", i));
|
||||
SearchContainer<SearchBase> result = await Config.Client.SearchMultiAsync("Jobs");
|
||||
await TestHelpers.SearchPagesAsync(i => TMDbClient.SearchMultiAsync("Jobs", i));
|
||||
SearchContainer<SearchBase> result = await TMDbClient.SearchMultiAsync("Jobs");
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
|
@ -69,7 +69,7 @@ namespace TMDbLibTests.UtilityTests
|
||||
public async Task TestJsonTaggedImageConverter()
|
||||
{
|
||||
// Get images
|
||||
SearchContainerWithId<TaggedImage> result = await Config.Client.GetPersonTaggedImagesAsync(IdHelper.HughLaurie, 1);
|
||||
SearchContainerWithId<TaggedImage> result = await TMDbClient.GetPersonTaggedImagesAsync(IdHelper.HughLaurie, 1);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.NotNull(result.Results);
|
||||
|
Loading…
Reference in New Issue
Block a user