Esempio n. 1
0
        public async Task TestAccountChangeMovieWatchlistStatusAsync()
        {
            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 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 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 TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.Terminator, false));

            // Check if it worked
            Assert.False(await DoesWatchListContainSpecificMovie(IdHelper.Terminator));
        }
Esempio n. 2
0
        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);
            });
        }
Esempio n. 3
0
        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);
            });
        }
Esempio n. 4
0
 public void addToWatchList([FromBody] int media_id)
 {
     TMDbClient client    = GetTMDbClient();
     bool       completed = client.AccountChangeWatchlistStatusAsync(MediaType.Movie, media_id, true).Result;
 }