public void ShouldCallToMoveElementsOnTimelineModelInRippleModeWhenExecuteCommand() { var track = new Track { TrackType = TrackType.Visual }; this.timelineModel.Tracks.Add(track); var previousElement = new TimelineElement { Position = TimeCode.FromAbsoluteTime(0, this.timelineModel.Duration.FrameRate), InPosition = TimeCode.FromAbsoluteTime(0, this.timelineModel.Duration.FrameRate), OutPosition = TimeCode.FromAbsoluteTime(20, this.timelineModel.Duration.FrameRate) }; var currentElement = new TimelineElement { Position = TimeCode.FromAbsoluteTime(20, this.timelineModel.Duration.FrameRate), InPosition = TimeCode.FromAbsoluteTime(0, this.timelineModel.Duration.FrameRate), OutPosition = TimeCode.FromAbsoluteTime(20, this.timelineModel.Duration.FrameRate) }; var nextElement = new TimelineElement { Position = TimeCode.FromAbsoluteTime(40, this.timelineModel.Duration.FrameRate), InPosition = TimeCode.FromAbsoluteTime(0, this.timelineModel.Duration.FrameRate), OutPosition = TimeCode.FromAbsoluteTime(20, this.timelineModel.Duration.FrameRate) }; this.timelineModel.GetElementAtPositionReturnFunction = () => { if (this.timelineModel.GetElementAtPositionPositionArgument == currentElement.Position) { return(previousElement); } else if (currentElement.Position + currentElement.Duration == this.timelineModel.GetElementAtPositionPositionArgument) { return(nextElement); } else { return(null); } }; RemoveElementCommand command = new RemoveElementCommand(this.timelineModel, track, EditMode.Ripple, currentElement); Assert.IsFalse(this.timelineModel.MoveElementCalled); command.Execute(); Assert.IsTrue(this.timelineModel.MoveElementCalled); Assert.AreEqual(nextElement, this.timelineModel.MoveElementElementArgument); }
private void RemoveElementExecute([NotNull] object toRemove) { if (toRemove == null) { throw new Exception("Element to remove can't be null"); } if (toRemove is Element toRemoveElementVM) { RemoveElementCommand removeElementCommand = new RemoveElementCommand(toRemoveElementVM, this); removeElementCommand.Execute(); MyCommandManager.AddToList(removeElementCommand); } }
public void ShouldCallToRemoveElementOnTimelineModel() { var track = new Track { TrackType = TrackType.Visual }; this.timelineModel.Tracks.Add(track); var timelineElement = new TimelineElement(); RemoveElementCommand command = new RemoveElementCommand(this.timelineModel, track, EditMode.Gap, timelineElement); Assert.IsFalse(this.timelineModel.RemoveElementCalled); command.Execute(); Assert.IsTrue(this.timelineModel.RemoveElementCalled); Assert.AreEqual(timelineElement, this.timelineModel.RemoveElementArgument); }