public void DeleteMethodOk() { clsWatchListCollection AllWatchListFilms = new clsWatchListCollection(); clsWatchList TestItem = new clsWatchList(); TestItem.UserId = 1; TestItem.FilmId = 7; AllWatchListFilms.ThisWatchListFilm = TestItem; AllWatchListFilms.Add(); AllWatchListFilms.ThisWatchListFilm.Find(TestItem.UserId, TestItem.FilmId); AllWatchListFilms.Delete(); Boolean found = AllWatchListFilms.ThisWatchListFilm.Find(TestItem.UserId, TestItem.FilmId); Assert.IsFalse(found); }
protected void imgbtnWatchLater_Click(object sender, ImageClickEventArgs e) { clsWatchListCollection AllFilmsInWatchList = new clsWatchListCollection(); AllFilmsInWatchList.ThisWatchListFilm.UserId = Convert.ToInt32(Session["UserId"]); AllFilmsInWatchList.ThisWatchListFilm.FilmId = Convert.ToInt32(Session["FilmId"]); filmInWatchList = Convert.ToBoolean(Session["filmInWatchList"]); if (!filmInWatchList) { AllFilmsInWatchList.Add(); imgbtnWatchLater.ImageUrl = "Images/WatchLaterAdded.png"; filmInWatchList = true; } else { AllFilmsInWatchList.Delete(); imgbtnWatchLater.ImageUrl = "Images/WatchLater.png"; filmInWatchList = false; } Session["filmInWatchList"] = filmInWatchList; }