public async Task TestAccountChangeMovieFavoriteStatusAsync()
        {
            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 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 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 TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.Terminator, false));

            // Check if it worked
            Assert.False(await DoesFavoriteListContainSpecificMovie(IdHelper.Terminator));
        }
Exemple #2
0
        protected void Favorit_btn_Click(object sender, EventArgs e)
        {
            TMDbClient client = new TMDbClient("e1b3af48ad2d28cab2fb3ac299948c08");

            client.SetSessionInformation(Program.Session_Id, SessionType.UserSession);

            if (Favorit_btn.Text != "Remove From Favorite")
            {
                client.AccountChangeFavoriteStatusAsync(MediaType.Movie, Movies_id, true);
                Favorit_btn.Text = "Remove From Favorite";
            }
            else
            {
                client.AccountChangeFavoriteStatusAsync(MediaType.Movie, Movies_id, false);
                Favorit_btn.Text = "Add To Favorite";
            }
        }
        public async Task TestMoviesAccountStateFavoriteSetAsync()
        {
            await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession);

            await TestMethodsHelper.SetValidateRemoveTest(
                () => TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true),
                () => TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false),
                async shouldBeSet =>
            {
                AccountState accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);

                Assert.Equal(shouldBeSet, accountState.Favorite);
            });
        }
Exemple #4
0
        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);
            });
        }
Exemple #5
0
 public void addToFavorite([FromBody] int media_id)
 {
     TMDbClient client    = GetTMDbClient();
     bool       completed = client.AccountChangeFavoriteStatusAsync(MediaType.Movie, media_id, true).Result;
 }