Beispiel #1
0
        public void CanUndoWithHistoryWithoutRollBack()
        {
            var history = new Mock <ITimeline>();
            {
                history.Setup(h => h.CanRollBack)
                .Returns(false);
            }

            var project = new Mock <IProject>();
            {
                project.Setup(p => p.History)
                .Returns(history.Object);
            }

            var projectFacade = new ProjectFacade(project.Object);
            var projectLink   = new Mock <ILinkToProjects>();
            {
                projectLink.Setup(p => p.ActiveProject())
                .Returns(projectFacade);
            }

            Func <string, IDisposable> timerFunc = s => new MockDisposable();

            var command = new UndoCommand(projectLink.Object, timerFunc);

            Assert.IsFalse(command.CanExecute(null));
        }
Beispiel #2
0
        public void CanUndoWithNullFacade()
        {
            Func <string, IDisposable> timerFunc = s => new MockDisposable();

            var command = new UndoCommand(null, timerFunc);

            Assert.IsFalse(command.CanExecute(null));
        }
Beispiel #3
0
        public void CanUndoWithoutActiveProject()
        {
            var projectLink = new Mock <ILinkToProjects>();
            {
                projectLink.Setup(p => p.HasActiveProject())
                .Returns(false);
            }

            Func <string, IDisposable> timerFunc = s => new MockDisposable();

            var command = new UndoCommand(projectLink.Object, timerFunc);

            Assert.IsFalse(command.CanExecute(null));
        }
Beispiel #4
0
        public void CanUndoWithMarkers()
        {
            var currentMark = new TimeMarker(10);
            var markers     = new List <TimeMarker>
            {
                currentMark,
                new TimeMarker(1),
            };
            var history = new Mock <ITimeline>();
            {
                history.Setup(h => h.CanRollBack)
                .Returns(true);
                history.Setup(h => h.MarkersInThePast())
                .Returns(markers);
                history.Setup(h => h.Current)
                .Returns(currentMark);
            }

            var project = new Mock <IProject>();
            {
                project.Setup(p => p.History)
                .Returns(history.Object);
            }

            var projectFacade = new ProjectFacade(project.Object);
            var projectLink   = new Mock <ILinkToProjects>();
            {
                projectLink.Setup(p => p.ActiveProject())
                .Returns(projectFacade);
                projectLink.Setup(p => p.HasActiveProject())
                .Returns(true);
            }

            Func <string, IDisposable> timerFunc = s => new MockDisposable();

            var command = new UndoCommand(projectLink.Object, timerFunc);

            Assert.IsTrue(command.CanExecute(null));
        }