public void TestChainedCancel() { PseudoCancellableChainCommand cmd1 = new PseudoCancellableChainCommand(); PseudoCancellableChainCommand cmd2 = new PseudoCancellableChainCommand(); PseudoCancellableChainCommand cmd3 = new PseudoCancellableChainCommand(); cmd1.Chain(cmd2).Chain(cmd3); cmd1.Cancel(); Check.That(cmd3.Counter).IsEqualTo(-1); }
public void TestClear() { bool onCancelFlag = false; bool onExecuteFlag = false; PseudoCancellableChainCommand cmd = new PseudoCancellableChainCommand(); cmd.OnCancel(delegate () { onCancelFlag = true; }); cmd.OnExecuteDone(delegate () { onExecuteFlag = true; }); cmd.Clear(); cmd.Execute(); cmd.Cancel(); Check.That(onExecuteFlag).IsFalse(); Check.That(onCancelFlag).IsFalse(); }