public void TestIgnoreRepetitiveActions() { var list = new PersistentList<string>(); var undoRedo = new UndoRedo<PersistentList<string>>(list); undoRedo.NewAction("add"); list.Add("1"); undoRedo.NewAction("add"); list.Add("2"); undoRedo.Undo(); Assert.True(list.Count == 1); undoRedo.IgnoreRepetitiveActions = true; undoRedo.NewAction("add"); list.Add("2"); undoRedo.Undo(); Assert.True(list.Count == 0); }
public void TestUndoRedo() { var a = new Persistent<string>("what?"); var undoRedo = new UndoRedo<Persistent<string>>(a); undoRedo.NewAction("Say something"); a.Value = "hello"; undoRedo.Undo(); Assert.True(a.Value == "what?"); undoRedo.Redo(); Assert.True(a.Value == "hello"); }