public void Test_Add_NTSC_HD_VideoClip_To_A_PAL_HD_VideoReel() { // Arrange var videoReel = new VideoReel() { VideoDefinition = VideoDefinition.HD, VideoStandard = VideoStandard.PAL, Name = "Video Two", TotalDuration = Timecode.Subtract(Timecode.FromString("00:00:20:10", FrameRate.FPS25), Timecode.FromString("00:00:00:00", FrameRate.FPS25)).ToString(), Id = 1, VideoClips = new List <VideoClip>() { DataHelper.GetaPALHDVideoClip() } }; this._videoClipService.Setup(x => x.GetClip(4)).Returns(DataHelper.GetaNTSCHDVideoClip()); // Act var viewModel = new VideoReelAddViewModel(this._videoReelService.Object, this._videoClipService.Object); var result = viewModel.AddClipToReel(videoReel, 4); viewModel.VideoClip = DataHelper.GetaNTSCHDVideoClip(); // Assert Assert.AreEqual(viewModel.CanAddClipToReel, false); Assert.AreEqual(viewModel.ErrorMessage, "Add failed.Video Standards do not match."); Assert.IsFalse(result); this._videoClipService.VerifyAll(); }
public void Test_Remove_A_Clip_To_A_Video_Reel() { /// Arrange var expectedVideoReel = new VideoReel() { VideoDefinition = VideoDefinition.SD, VideoStandard = VideoStandard.NTSC, Name = "Video Eight", TotalDuration = "00:00:54:08", Id = 1, VideoClips = new List <VideoClip>() { DataHelper.GetaNTSCSDVideoClip(), DataHelper.GetaNTSCSDVideoClipB() } }; var serviceToBeTested = new VideoReelService(this._videoReelRepository.Object, this._reelClipLinkRepository.Object); this._reelClipLinkRepository.Setup(x => x.RemoveClipFromReel(It.IsAny <VideoReel>(), It.IsAny <VideoClip>())).Returns(true); /// Act var actual = serviceToBeTested.RemoveClipFromReel(expectedVideoReel, DataHelper.GetaNTSCSDVideoClipC()); /// Assert Assert.AreEqual(true, actual); }
public void Test_Get_Video_Clip_Details() { // Arrange var videoReel = new VideoReel() { VideoDefinition = VideoDefinition.HD, VideoStandard = VideoStandard.NTSC, Name = "Video Two", TotalDuration = Timecode.Subtract(Timecode.FromString("00:00:20:10", FrameRate.FPS30), Timecode.FromString("00:00:00:00", FrameRate.FPS30)).ToString(), Id = 1, VideoClips = new List <VideoClip>() { DataHelper.GetaNTSCHDVideoClip() } }; this._videoClipService.Setup(x => x.GetClip(3)).Returns(DataHelper.GetaPALHDVideoClip()); var viewModel = new VideoReelAddViewModel(this._videoReelService.Object, this._videoClipService.Object); viewModel.GetVideoClipDetails(3); Assert.AreEqual(viewModel.VideoClip.Id, 3); Assert.AreEqual(viewModel.VideoClip.VideoStandard, VideoStandard.PAL); Assert.AreEqual(viewModel.VideoClip.VideoDefinition, VideoDefinition.HD); Assert.AreEqual(viewModel.VideoClip.Description, "Video Promo"); Assert.AreEqual(viewModel.VideoClip.Name, "Captain America: The First Avenger"); }
/// <summary> /// Remove Clip From a Reel /// </summary> /// <param name="videoReel">Video Reel</param> /// <param name="clipId">Video clip Id</param> /// <returns>true in case of success</returns> public bool RemoveClipFromReel(VideoReel videoReel, int clipId) { this.VideoReel = videoReel; return(this._videoReelService.RemoveClipFromReel(videoReel, new VideoClip { Id = clipId })); }
public void Test_Add_PAL_HD_VideoClip_To_A_PAL_HD_VideoReel() { // Arrange var videoReel = new VideoReel() { VideoDefinition = VideoDefinition.HD, VideoStandard = VideoStandard.PAL, Name = "Video Two", TotalDuration = Timecode.Subtract(Timecode.FromString("00:00:20:10", FrameRate.FPS25), Timecode.FromString("00:00:00:00", FrameRate.FPS25)).ToString(), Id = 1, VideoClips = new List <VideoClip>() { DataHelper.GetaPALHDVideoClip() } }; this._videoClipService.Setup(x => x.GetClip(3)) .Returns( new VideoClip() { Id = 4, Name = "Captain America: The First Avenger New", Description = "Video Promo", VideoStandard = VideoStandard.PAL, VideoDefinition = VideoDefinition.HD, StartTime = "00:00:00:00", EndTime = "00:00:20:10" }); this._videoReelService.Setup(x => x.GetClipsForaReel(It.IsAny <int>())).Returns(new List <VideoClip>() { DataHelper.GetaPALHDVideoClip() }); var viewModel = new VideoReelAddViewModel(this._videoReelService.Object, this._videoClipService.Object); viewModel.VideoClips = new List <VideoClip>() { DataHelper.GetaPALHDVideoClip() }; viewModel.VideoClip = new VideoClip() { Id = 4, Name = "Captain America: The First Avenger New", Description = "Video Promo", VideoStandard = VideoStandard.PAL, VideoDefinition = VideoDefinition.HD, StartTime = "00:00:00:00", EndTime = "00:00:20:10" }; // Act var result = viewModel.AddClipToReel(videoReel, 3); // Assert Assert.AreEqual(viewModel.CanAddClipToReel, true); Assert.AreEqual(viewModel.ErrorMessage, string.Empty); Assert.IsTrue(result); }
/// <summary> /// Add Clip To Reel /// </summary> /// <param name="videoReel">Video Reel</param> /// <param name="clipId">Video clip Id</param>¬ /// <returns>true in case of success</returns> public bool AddClipToReel(VideoReel videoReel, int clipId) { this.VideoReel = videoReel; this.GetVideoClipDetails(clipId); this.VideoClips = videoReel.VideoClips = this.GetVideoClipsForVideoReel(VideoReel); if (!this.CanAddClipToReel) { return(false); } this._videoReelService.AddClipToReel(this.VideoReel, new VideoClip { Id = clipId }); this.CalculateDuratiion(this.VideoReel); return(true); }
/// <summary> /// Save a video reel Name /// </summary> /// <param name="videoReel">video reel</param> public bool SaveVideoReel(VideoReel videoReel) { var database = ApplicationDatabase.Create(); try { using (var command = database.GetStoredProcCommand(Constants.Procedure_SaveVideoReel)) { database.AddInParameter(command, Constants.Parameter_VideoReelName, DbType.String, videoReel.Name); database.AddInParameter(command, Constants.Parameter_VideoReelId, DbType.Int32, videoReel.Id); database.ExecuteNonQuery(command); return(true); } } catch { return(false); } }
/// <summary> /// Remove a clip from a reel /// </summary> /// <param name="reel">reel details</param> /// <param name="clip">clip details</param> /// <returns>true/ false </returns> public bool RemoveClipFromReel(VideoReel reel, VideoClip clip) { var database = ApplicationDatabase.Create(); try { using (var command = database.GetStoredProcCommand(Constants.Procedure_RemoveClipFromReel)) { database.AddInParameter(command, Constants.Parameter_VideoReelId, DbType.Int32, reel.Id); database.AddInParameter(command, Constants.Parameter_VideoClipId, DbType.Int32, clip.Id); database.ExecuteNonQuery(command); return(true); } } catch { return(false); } }
private string CalculateDuration(VideoReel videoReel) { Timecode timeCode = Timecode.FromString("00:00:00:00", videoReel.VideoStandard.FrameRate().ToFrameRate()); foreach (var videoClip in videoReel.VideoClips) { if (timeCode != null) { timeCode = Timecode.Add(timeCode, Timecode.Subtract( Timecode.FromString(videoClip.EndTime, videoClip.VideoStandard.FrameRate().ToFrameRate()), Timecode.FromString(videoClip.StartTime, videoClip.VideoStandard.FrameRate().ToFrameRate()))); } else { timeCode = Timecode.Subtract( Timecode.FromString(videoClip.EndTime, videoClip.VideoStandard.FrameRate().ToFrameRate()), Timecode.FromString(videoClip.StartTime, videoClip.VideoStandard.FrameRate().ToFrameRate())); } } return(videoReel.TotalDuration = timeCode.ToString()); }
/// <summary> /// Save a video reel /// </summary> /// <param name="videoReel">video reel</param> public bool SaveVideoReel(VideoReel videoReel) { return(this._repository.SaveVideoReel(videoReel)); }
/// <summary> /// Remove a video clip from a reel /// </summary> /// <param name="videoReel"> /// The video Reel. /// </param> /// <param name="videoClip"> /// video clip /// </param> public bool RemoveClipFromReel(VideoReel videoReel, VideoClip videoClip) { return(this._reelClipLinkRepository.RemoveClipFromReel(videoReel, videoClip)); }
/// <summary> /// Add a video clip /// </summary> /// <param name="videoReel"> /// The video Reel. /// </param> /// <param name="videoClip"> /// video clip /// </param> /// <returns>true/ false</returns> public bool AddClipToReel(VideoReel videoReel, VideoClip videoClip) { return(this._reelClipLinkRepository.AddClipToReel(videoReel, videoClip)); }
/// <summary> /// Modify a video Reel /// </summary> /// <param name="videoReel">video reel</param> /// <returns>true if success else false.</returns> public bool ModifyReel(VideoReel videoReel) { return(this._videoReelService.SaveVideoReel(videoReel)); }
private IList <VideoClip> GetVideoClipsForVideoReel(VideoReel videoReel) { return(this._videoReelService.GetClipsForaReel(videoReel.Id)); }