예제 #1
0
        public void SaveVideo_NotInDatabase_VideoSaved()
        {
            Video video = Helpers.CreateUnsavedVideoWithId();

            VideoManager.Save(video);

            Video videoFromDatabase = VideoManager.Get(video.Id);

            //  Test that the video was successfully inserted
            Assert.IsNotNull(videoFromDatabase);
            Assert.AreEqual(video.Title, videoFromDatabase.Title);
        }
예제 #2
0
        public IActionResult DeleteVideo(int id)
        {
            var video = videoManager.Get().Where(e => e.Id == id).FirstOrDefault();

            videoManager.Delete(video);
            return(RedirectToAction("Index"));
        }
예제 #3
0
        public void CreateItem_NoVideoExists_VideoAndItemCreated()
        {
            PlaylistItem playlistItem = Helpers.CreateItemInPlaylist(Playlist);

            //  Ensure that the Video was created.
            Video videoFromDatabase = VideoManager.Get(playlistItem.Video.Id);

            Assert.NotNull(videoFromDatabase);

            //  Ensure that the PlaylistItem was created.
            PlaylistItem itemFromDatabase = PlaylistItemManager.Get(playlistItem.Id);

            Assert.NotNull(itemFromDatabase);

            //  Should have a sequence number after saving for sure.
            Assert.GreaterOrEqual(itemFromDatabase.Sequence, 0);

            //  Pointers should be self-referential with only one item in the Playlist.
            //Assert.AreEqual(itemFromDatabase.NextItem, itemFromDatabase);
            //Assert.AreEqual(itemFromDatabase.PreviousItem, itemFromDatabase);
        }