public void GetVideosByPlaylistId_ReturnsValidFirstVideoFromApi()
        {
            _cacheService.Setup(x => x.Get(It.IsAny <string>())).Returns(null);

            Playlist youTubePlaylist = _youTubeService.GetVideosByPlaylistId("PLOGi5-fAu8bEyLwr2Ddjq9lDM2Fd0SpCH");

            Assert.Greater(youTubePlaylist.Items.Count, 0);

            var youTubeVideo = youTubePlaylist.Items.FirstOrDefault().Snippet;

            Assert.IsNotNull(youTubeVideo);

            Assert.IsNotEmpty(youTubeVideo.Title);
            Assert.IsNotEmpty(youTubeVideo.Description);
        }
Пример #2
0
        public ActionResult Update()
        {
            if (!ModelState.IsValid)
            {
                return(CurrentUmbracoPage());
            }

            // Get YouTube videos from TED playlist https://www.youtube.com/playlist?list=PLOGi5-fAu8bEyLwr2Ddjq9lDM2Fd0SpCH
            var playlist = _youTubeService.GetVideosByPlaylistId("PLOGi5-fAu8bEyLwr2Ddjq9lDM2Fd0SpCH");

            _videoService.UpdateVideosWithYouTubePlaylist(playlist, Umbraco);

            HomeViewModel viewModel = new HomeViewModel(CurrentPage);

            viewModel.Videos = _videoService.GetAllVideos(Umbraco);

            return(View("Home", viewModel));
        }