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); }
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); }