public new void SetUp() { base.SetUp(); myCommand = new MyTestCommand(); handler.Execute(myCommand); mockUndoRedo.Setup(x => x.Undo()).Returns(myCommand); }
public void ShouldInvokeTheCommand() { // Arrange var myCommand = new MyTestCommand(); // Act handler.Execute(myCommand); // Assert Assert.IsTrue(myCommand.HasExecuted, "should have been executed"); }
public void ShouldRethrowAnyExceptionFiredBy() { // Arrange var myCommand = new MyTestCommand() { ThrowExceptionOnExecuting = true }; // Act / assert Assert.ThrowsException <ApplicationException>(() => { handler.Execute(myCommand); }); }
public void ShouldAddTheCommandToTheUndoStack() { // Arrange var myCommand = new MyTestCommand(); // Act handler.Execute(myCommand); // Assert mockUndoRedo.Verify(x => x.AddItem(myCommand), Times.Once(), "The command should have been added to the undo stack"); }
public new void SetUp() { base.SetUp(); myCommand = new MyTestCommand(); mockUndoRedo.Setup(x => x.Undo()).Returns(myCommand); mockUndoRedo.Setup(x => x.Redo()).Returns(myCommand); handler.Execute(myCommand); handler.Undo(); myCommand.HasExecuted = false; // Reset it }
public new void TearDown() { base.TearDown(); myCommand = null; }