コード例 #1
0
        public void RemoveSelectedElementCallsWixPackageFilesRemoveSelectedElementMethod()
        {
            RemoveElementCommand command = new RemoveElementCommand(mockWorkbench);

            command.Run();
            Assert.IsTrue(mockPackageFilesControl.RemoveSelectedElementMethodCalled);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
        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);
        }