예제 #1
0
        public void UndoAfterExecuteCommitTest()
        {
            //Arrange
            bool hasInnerExecute = false;
            bool hasInnerUndo    = false;

            SwitchCommandMock mock = new SwitchCommandMock();

            mock.OnInnerExecute += () =>
            {
                return(hasInnerExecute = true);
            };
            mock.OnInnerUndo += () =>
            {
                return(hasInnerUndo = true);
            };

            //Act
            bool executeResult = mock.Execute();

            mock.Commit();
            bool undoResult = mock.Undo();

            //Assert
            Assert.IsTrue(executeResult);
            Assert.IsFalse(undoResult);
            Assert.IsTrue(hasInnerExecute);
            Assert.IsFalse(hasInnerUndo);
        }
예제 #2
0
        public void ExecuteTest()
        {
            //Arrange
            bool hasInnerExecuted = false;

            SwitchCommandMock mock = new SwitchCommandMock();

            mock.OnInnerExecute += () =>
            {
                return(hasInnerExecuted = true);
            };

            //Act
            bool executeResult = mock.Execute();

            //Assert
            Assert.IsTrue(executeResult);
            Assert.IsTrue(hasInnerExecuted);
        }