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); }
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); }
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); }