public void UpdateEnclosureVideoAddEncVidUrlExists()
        {
            var videos = enclosureController.GetEnclosureVideosById(1);

            Assert.AreEqual(1, videos.Count());

            var vid = videos.First();

            Assert.AreEqual("video1", vid.videoUrl);
            Assert.AreEqual(1, vid.enclosureId);

            var newVid = new YoutubeVideoUrl
            {
                id          = default(int),
                enclosureId = 1,
                videoUrl    = "video2"
            };

            enclosureController.UpdateEnclosureVideo(newVid);
        }
Ejemplo n.º 2
0
        public void UpdateEnclosureVideosEmptyUrl()
        {
            var videos = context.GetEnclosureVideosById(1);

            Assert.AreEqual(1, videos.Count());

            var vid = videos.First();

            Assert.AreEqual("video1", vid.videoUrl);
            Assert.AreEqual(1, vid.enclosureId);

            var newVid = new YoutubeVideoUrl
            {
                id          = default(int),
                enclosureId = 1,
                videoUrl    = ""
            };

            context.UpdateEnclosureVideo(newVid);
        }
Ejemplo n.º 3
0
        public YoutubeVideoUrl UpdateEnclosureVideo(YoutubeVideoUrl enclosureVideo)
        {
            try
            {
                using (var db = this.GetContext())
                {
                    if (ValidateSessionId(db))
                    {
                        return(db.UpdateEnclosureVideo(enclosureVideo));
                    }
                    else
                    {
                        throw new AuthenticationException("Couldn't validate the session");
                    }
                }
            }
            catch (Exception Exp)
            {
                string videoInput = "Id: " + enclosureVideo.id + ", enclosure Id: " + enclosureVideo.enclosureId + ", video Url: " + enclosureVideo.videoUrl;

                Logger.GetInstance(isTesting).WriteLine(Exp.Message, Exp.StackTrace, "Enclosure video: " + videoInput);
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError));
            }
        }
        public void UpdateEnclosureVideoAddEncVidValidInput()
        {
            var videos = enclosureController.GetEnclosureVideosById(1);

            Assert.AreEqual(1, videos.Count());

            var vid = videos.First();

            Assert.AreEqual("video1", vid.videoUrl);
            Assert.AreEqual(1, vid.enclosureId);

            var newVid = new YoutubeVideoUrl
            {
                id          = default(int),
                enclosureId = 1,
                videoUrl    = "video4"
            };

            enclosureController.UpdateEnclosureVideo(newVid);

            videos = enclosureController.GetEnclosureVideosById(1);
            Assert.AreEqual(2, videos.Count());
            Assert.AreEqual("video4", videos.SingleOrDefault(p => p.videoUrl == "video4").videoUrl);
        }