Esempio n. 1
0
        public void TestAddTvShowToMedia()
        {
            AddTvShows(1);

            MediaLibContainer context = ContextHelper <MediaLibContainer> .GetCurrentContext();

            TV_Show show           = context.MediaSet.OfType <TV_Show>().First <TV_Show>();
            int     expectedShowId = show.Id;

            MediaController mediaController = new MediaController();

            FormCollection collection = new FormCollection();

            collection["ctl00$MainContent$TvShowTitle"]         = show.Title;
            collection["ctl00$MainContent$TvShowTitleOriginal"] = show.OriginalTitle;
            collection["GenreList"] = show.Genre;
            collection["ctl00$MainContent$DatepickerBeginning"] = show.ShowBeginning.ToShortDateString();
            if (show.ShowEnding != null)
            {
                collection["ctl00$MainContent$DatepickerEnding"] = show.ShowEnding.Value.ToShortDateString();
            }
            collection["SeasonList"] = show.Season.Count.ToString();

            ViewResult result = mediaController.AddTvShowToDb(collection, fakeUser) as ViewResult;
            TV_Show    s      = MediaService.Instance.GetTvShowById(show.Id);

            addedMedia.Add(s);

            Assert.IsNotNull(s);
            Assert.AreEqual(expectedShowId, s.Id);
        }