public void TestCtr() { var dummy = new TestDummay0(); Action exeAction = dummy.Inc; Action undoAction = dummy.Dec; Assert.Throws <ArgumentNullException> (() => Command.Create(null, null)); Assert.Throws <ArgumentNullException> (() => Command.Create(exeAction, null)); Assert.Throws <ArgumentNullException> (() => Command.Create(null, undoAction)); }
public void TestCtr() { var dummy = new TestDummay0 (); Action exeAction = dummy.Inc; Action undoAction = dummy.Dec; Assert.Throws<ArgumentNullException> (() => Command.Create (null, null)); Assert.Throws<ArgumentNullException> (() => Command.Create (exeAction, null)); Assert.Throws<ArgumentNullException> (() => Command.Create (null, undoAction)); }
public void TestExecute() { var dummy = new TestDummay0 (); Action exeAction = dummy.Inc; Action undoAction = dummy.Dec; var command = Command.Create (exeAction, undoAction); command.Execute (); Assert.AreEqual (dummy.Number, 1); command.Execute (); Assert.AreEqual (dummy.Number, 2); command.Undo (); Assert.AreEqual (dummy.Number, 1); command.Redo (); Assert.AreEqual (dummy.Number, 2); }
public void TestExecute() { var dummy = new TestDummay0(); Action exeAction = dummy.Inc; Action undoAction = dummy.Dec; var command = Command.Create(exeAction, undoAction); command.Execute(); Assert.AreEqual(dummy.Number, 1); command.Execute(); Assert.AreEqual(dummy.Number, 2); command.Undo(); Assert.AreEqual(dummy.Number, 1); command.Redo(); Assert.AreEqual(dummy.Number, 2); }