public void TestMoviesImdbExtrasAll() { Dictionary <MovieMethods, Func <Movie, object> > tmpMethods = new Dictionary <MovieMethods, Func <Movie, object> >(_methods); tmpMethods.Remove(MovieMethods.Changes); tmpMethods.Remove(MovieMethods.SimilarMovies); // See https://github.com/LordMike/TMDbLib/issues/19 _config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession); MovieMethods combinedEnum = tmpMethods.Keys.Aggregate((methods, movieMethods) => methods | movieMethods); Movie item = _config.Client.GetMovie(AGoodDayToDieHardImdb, combinedEnum); TestMethodsHelper.TestAllNotNull(tmpMethods, item); }
public void TestMoviesExtrasAll() { // We ignore the 'notes' field, as TMDb sometimes leaves it out IgnoreMissingJson("release_dates.results[array].release_dates[array] / note"); IgnoreMissingJson("similar.results[array] / media_type"); IgnoreMissingJson(" / id", "alternative_titles / id", "credits / id", "keywords / id", "release_dates / id", "releases / id", "translations / id", "videos / id", " / recommendations"); Config.Client.SetSessionInformation(Config.UserSessionId, SessionType.UserSession); MovieMethods combinedEnum = _methods.Keys.Aggregate((methods, movieMethods) => methods | movieMethods); Movie item = Config.Client.GetMovieAsync(IdHelper.AGoodDayToDieHard, combinedEnum).Result; TestMethodsHelper.TestAllNotNull(_methods, item); }
public async Task TestMoviesAccountStateWatchlistSetAsync() { await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession); await TestMethodsHelper.SetValidateRemoveTest( () => TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true), () => TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false), async shouldBeSet => { AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad); Assert.Equal(shouldBeSet, accountState.Watchlist); }); }
public async Task TestMoviesAccountStateRatingSetAsync() { await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession); await TestMethodsHelper.SetValidateRemoveTest( () => TMDbClient.MovieSetRatingAsync(IdHelper.MadMaxFuryRoad, 7.5), () => TMDbClient.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad), async shouldBeSet => { AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad); Assert.Equal(shouldBeSet, accountState.Rating.HasValue); }); }
public void TestTvSeasonExtrasAll() { _config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession); // Account states will only show up if we've done something _config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5).Wait(); TvSeasonMethods combinedEnum = _methods.Keys.Aggregate((methods, tvSeasonMethods) => methods | tvSeasonMethods); TvSeason tvSeason = _config.Client.GetTvSeasonAsync(IdHelper.BreakingBad, 1, combinedEnum).Result; TestBreakingBadBaseProperties(tvSeason); TestMethodsHelper.TestAllNotNull(_methods, tvSeason); }
public void TestMoviesExtrasExclusive() { // Ignore missing json IgnoreMissingJson("similar.results[array] / media_type"); // We ignore the 'notes' field, as TMDb sometimes leaves it out IgnoreMissingJson("release_dates.results[array].release_dates[array] / note"); IgnoreMissingJson(" / id"); // We will intentionally ignore errors reg. missing JSON as we do not request it IgnoreMissingJson(" / account_states", " / alternative_titles", " / changes", " / credits", " / images", " / keywords", " / lists", " / release_dates", " / releases", " / reviews", " / similar", " / translations", " / videos", "alternative_titles / id", "credits / id", "keywords / id", "release_dates / id", "releases / id", "translations / id", "videos / id", " / recommendations"); Config.Client.SetSessionInformation(Config.UserSessionId, SessionType.UserSession); TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => Config.Client.GetMovieAsync(id, extras).Result, IdHelper.AGoodDayToDieHard); }
public void TestMoviesImdbExtrasAll() { Dictionary <MovieMethods, Func <Movie, object> > tmpMethods = new Dictionary <MovieMethods, Func <Movie, object> >(_methods); tmpMethods.Remove(MovieMethods.Videos); _config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession); // Account states will only show up if we've done something _config.Client.MovieSetRating(TheDarkKnightRises, 5); MovieMethods combinedEnum = tmpMethods.Keys.Aggregate((methods, movieMethods) => methods | movieMethods); Movie item = _config.Client.GetMovie(TheDarkKnightRises, combinedEnum).Result; TestMethodsHelper.TestAllNotNull(tmpMethods, item); }
public void TestTvShowExtrasAll() { IgnoreMissingJson(" / id"); IgnoreMissingJson(" / genre_ids", " / known_for", " / similar", " / translations", " / videos", "alternative_titles / id", "content_ratings / id", "credits / id", "external_ids / id", "keywords / id", " / recommendations"); Config.Client.SetSessionInformation(Config.UserSessionId, SessionType.UserSession); // Account states will only show up if we've done something Config.Client.TvShowSetRatingAsync(IdHelper.BreakingBad, 5).Sync(); TvShowMethods combinedEnum = _methods.Keys.Aggregate((methods, tvShowMethods) => methods | tvShowMethods); TvShow tvShow = Config.Client.GetTvShowAsync(IdHelper.BreakingBad, combinedEnum).Result; TestBreakingBadBaseProperties(tvShow); TestMethodsHelper.TestAllNotNull(_methods, tvShow); }
public void TestTvEpisodeExtrasAll() { _config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession); // Account states will only show up if we've done something _config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5).Wait(); TvEpisodeMethods combinedEnum = _methods.Keys.Aggregate((methods, tvEpisodeMethods) => methods | tvEpisodeMethods); TvEpisode tvEpisode = _config.Client.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, combinedEnum).Result; TestBreakingBadSeasonOneEpisodeOneBaseProperties(tvEpisode); Assert.IsNotNull(tvEpisode.Images); Assert.IsNotNull(tvEpisode.Images.Stills); Assert.IsTrue(tvEpisode.Images.Stills.Count > 0); TestMethodsHelper.TestAllNotNull(_methods, tvEpisode); }
public void TestMoviesImdbExtrasAll() { IgnoreMissingJson(" / id", " / videos", "alternative_titles / id", "credits / id", "keywords / id", "release_dates / id", "releases / id", "reviews.results[array] / media_type", "translations / id"); Dictionary <MovieMethods, Func <Movie, object> > tmpMethods = new Dictionary <MovieMethods, Func <Movie, object> >(_methods); tmpMethods.Remove(MovieMethods.Videos); Config.Client.SetSessionInformation(Config.UserSessionId, SessionType.UserSession); // Account states will only show up if we've done something Config.Client.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5).Sync(); MovieMethods combinedEnum = tmpMethods.Keys.Aggregate((methods, movieMethods) => methods | movieMethods); Movie item = Config.Client.GetMovieAsync(IdHelper.TheDarkKnightRises, combinedEnum).Result; TestMethodsHelper.TestAllNotNull(tmpMethods, item); }
public void TestTvSeasonExtrasAll() { // TMDb is sending an extra property IgnoreMissingCSharp("_id / _id"); IgnoreMissingJson("images / id", "account_states / id", "credits / id", "external_ids / id", "videos / id"); Config.Client.SetSessionInformation(Config.UserSessionId, SessionType.UserSession); // Account states will only show up if we've done something Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5).Sync(); TvSeasonMethods combinedEnum = _methods.Keys.Aggregate((methods, tvSeasonMethods) => methods | tvSeasonMethods); TvSeason tvSeason = Config.Client.GetTvSeasonAsync(IdHelper.BreakingBad, 1, combinedEnum).Result; TestBreakingBadBaseProperties(tvSeason); TestMethodsHelper.TestAllNotNull(_methods, tvSeason); }
public void TestTvEpisodeExtrasAll() { IgnoreMissingJson("credits / id", "external_ids / id", "images / id", "videos / id"); Config.Client.SetSessionInformation(Config.UserSessionId, SessionType.UserSession); // Account states will only show up if we've done something Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5).Sync(); TvEpisodeMethods combinedEnum = _methods.Keys.Aggregate((methods, tvEpisodeMethods) => methods | tvEpisodeMethods); TvEpisode tvEpisode = Config.Client.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, combinedEnum).Result; TestBreakingBadSeasonOneEpisodeOneBaseProperties(tvEpisode); Assert.NotNull(tvEpisode.Images); Assert.NotNull(tvEpisode.Images.Stills); Assert.True(tvEpisode.Images.Stills.Count > 0); TestMethodsHelper.TestAllNotNull(_methods, tvEpisode); }
public async Task TestTvShowAccountStateWatchlistSet() { await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession); await TestMethodsHelper.SetValidateRemoveTest(async() => { // Add to watchlist await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true); }, async() => { // Remove from watchlist await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false); }, async shouldBe => { AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad); Assert.Equal(IdHelper.BreakingBad, accountState.Id); Assert.Equal(shouldBe, accountState.Watchlist); }); }
public async Task TestTvShowAccountStateFavoriteSet() { await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession); await TestMethodsHelper.SetValidateRemoveTest(async() => { // Favourite the movie await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true); }, async() => { // Un-favorite the movie await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false); }, async shouldBe => { AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad); Assert.Equal(IdHelper.BreakingBad, accountState.Id); Assert.Equal(shouldBe, accountState.Favorite); }); }
public async Task TestTvSeasonAccountStateRatingSetAsync() { await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession); await TestMethodsHelper.SetValidateRemoveTest( () => TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 3, 5), () => TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 3), async shouldBeSet => { ResultContainer <TvEpisodeAccountStateWithNumber> state = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1); if (shouldBeSet) { Assert.Contains(state.Results, x => x.EpisodeNumber == 3 && x.Rating.HasValue); } else { Assert.Contains(state.Results, x => x.EpisodeNumber == 3 && !x.Rating.HasValue); } }); }
public async Task TestTvEpisodeSetRatingGuestSessionAsync() { await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession); await TestMethodsHelper.SetValidateRemoveTest(async() => { Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 7.5)); }, async() => { Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1)); }, async shouldBeSet => { SearchContainer <TvEpisodeWithRating> ratings = await TMDbClient.GetGuestSessionRatedTvEpisodesAsync(); if (shouldBeSet) { Assert.Contains(ratings.Results, x => x.ShowId == IdHelper.BreakingBad && x.SeasonNumber == 1 && x.EpisodeNumber == 1); } else { Assert.DoesNotContain(ratings.Results, x => x.ShowId == IdHelper.BreakingBad && x.SeasonNumber == 1 && x.EpisodeNumber == 1); } }); }
public async Task TestMoviesSetRatingGuestSessionAsync() { await TMDbClient.SetSessionInformationAsync(TestConfig.GuestTestSessionId, SessionType.GuestSession); await TestMethodsHelper.SetValidateRemoveTest(async() => { Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 7.5)); }, async() => { Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.Terminator)); }, async shouldBeSet => { SearchContainer <SearchMovieWithRating> ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync(); if (shouldBeSet) { Assert.Contains(ratings.Results, x => x.Id == IdHelper.Terminator); } else { Assert.DoesNotContain(ratings.Results, x => x.Id == IdHelper.Terminator); } }); }
public async Task TestTvEpisodeExtrasExclusiveAsync() { await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession); await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetTvEpisodeAsync(IdHelper.BreakingBad, 1, 1, extras)); }
public void TestCollectionsExtrasExclusive() { TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => Config.Client.GetCollectionAsync(id, extras).Result, IdHelper.JamesBondCollection); }
public void TestCompaniesExtrasExclusive() { TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetCompany(id, extras), TwentiethCenturyFox); }
public void TestTvSeasonExtrasExclusive() { _config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession); TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetTvSeason(id, 1, extras).Result, BreakingBad); }
public async Task TestCompaniesExtrasExclusive() { await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetCompanyAsync(IdHelper.TwentiethCenturyFox, extras)); }
public async Task TestCollectionsExtrasAll() { await TestMethodsHelper.TestGetAll(Methods, combined => TMDbClient.GetCollectionAsync(IdHelper.BackToTheFutureCollection, combined), async collection => await Verify(collection)); }
public async Task TestCollectionsExtrasExclusive() { await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetCollectionAsync(IdHelper.BackToTheFutureCollection, extras)); }
public void TestCollectionsExtrasExclusive() { TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetCollection(id, extras), JamesBondCollection); }
public void TestMoviesExtrasExclusive() { TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetMovie(id, extras), AGoodDayToDieHard); }
public void TestPersonsExtrasExclusive() { TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetPerson(id, extras), BruceWillis); }
public async Task TestPersonsExtrasExclusive() { await TestMethodsHelper.TestGetExclusive(Methods, extras => TMDbClient.GetPersonAsync(IdHelper.BruceWillis, extras)); }
public void TestMoviesExtrasExclusive() { _config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession); TestMethodsHelper.TestGetExclusive(_methods, (id, extras) => _config.Client.GetMovie(id, extras), AGoodDayToDieHard); }
public async Task TestPersonsExtrasAllAsync() { await TestMethodsHelper.TestGetAll(Methods, combined => TMDbClient.GetPersonAsync(IdHelper.FrankSinatra, combined), async person => await Verify(person)); }