Exemple #1
0
        public void AddMethodOk()
        {
            clsFavouriteFilmCollection AllFavouriteFilms = new clsFavouriteFilmCollection();
            clsFavouriteFilm           testItem          = new clsFavouriteFilm();

            testItem.UserId = 1;
            testItem.FilmId = 14;
            AllFavouriteFilms.ThisFavouriteFilm = testItem;
            AllFavouriteFilms.Add();
            AllFavouriteFilms.ThisFavouriteFilm.Find(testItem.UserId, testItem.FilmId);
            Assert.AreEqual(AllFavouriteFilms.ThisFavouriteFilm, testItem);
        }
Exemple #2
0
        public void DeleteMethodOk()
        {
            clsFavouriteFilmCollection AllFavouriteFilms = new clsFavouriteFilmCollection();
            clsFavouriteFilm           testItem          = new clsFavouriteFilm();

            testItem.UserId = 1;
            testItem.FilmId = 15;
            AllFavouriteFilms.ThisFavouriteFilm = testItem;
            AllFavouriteFilms.Add();
            AllFavouriteFilms.ThisFavouriteFilm.Find(testItem.UserId, testItem.FilmId);
            AllFavouriteFilms.Delete();
            Boolean found = AllFavouriteFilms.ThisFavouriteFilm.Find(testItem.UserId, testItem.FilmId);

            Assert.IsFalse(found);
        }
        protected void imgbtnFavourite_Click(object sender, ImageClickEventArgs e)
        {
            clsFavouriteFilmCollection AllFavouriteFilms = new clsFavouriteFilmCollection();

            AllFavouriteFilms.ThisFavouriteFilm.UserId = Convert.ToInt32(Session["UserId"]);
            AllFavouriteFilms.ThisFavouriteFilm.FilmId = Convert.ToInt32(Session["FilmId"]);

            filmInFavourites = Convert.ToBoolean(Session["filmInFavourites"]);
            if (!filmInFavourites)
            {
                AllFavouriteFilms.Add();
                imgbtnFavourite.ImageUrl = "Images/FavouriteInList.png";
                filmInFavourites         = true;
            }
            else
            {
                AllFavouriteFilms.Delete();
                imgbtnFavourite.ImageUrl = "Images/Favourite.png";
                filmInFavourites         = false;
            }
            Session["filmInFavourites"] = filmInFavourites;
        }