public async Task TestTvShowAccountStateRatingSet() { await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession); await TestMethodsHelper.SetValidateRemoveTest(async() => { // Rate await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5); }, async() => { // Un-rate Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad)); }, async shouldBe => { AccountState accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad); Assert.Equal(IdHelper.BreakingBad, accountState.Id); if (shouldBe) { Assert.NotNull(accountState.Rating); Assert.Equal(5, accountState.Rating.Value); } else { Assert.Null(accountState.Rating); } }); }
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 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 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 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 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); } }); }