public void Undo0() { var cl = new TstClient(); var a = cl.GetRoot<RootVM>().AItems.First(); var init = a.Value; a.Value = 10; a.Value = 20; cl.Undo(a.Uid); Assert.AreEqual(10, a.Value); cl.Undo(a.Uid); Assert.AreEqual(init, a.Value); }
public void Undo0() { var cl = new TstClient(); var a = cl.GetRoot <RootVM>().AItems.First(); var init = a.Value; a.Value = 10; a.Value = 20; cl.Undo(a.Uid); Assert.AreEqual(10, a.Value); cl.Undo(a.Uid); Assert.AreEqual(init, a.Value); }
public void Undo2() { var cl = new TstClient(); var rt = cl.GetRoot<Root>(); var cnt = rt.AItems.Count; var a = new A {Value = 1}; rt.AItems.Add(a); a.Value = 2; cl.Undo(rt.Uid); Assert.AreEqual(1, a.Value); cl.Undo(rt.Uid); Assert.AreEqual(cnt, rt.AItems.Count); }
public void GetIsUndoEnabledAfterChangesAndUndo() { var cl = new TstClient(); var a = cl.GetRoot<RootVM>().AItems.First(); a.Value = 10; Assert.AreEqual(true, cl.GetIsUndoEnabled(a.Uid)); a.Value = 20; Assert.AreEqual(true, cl.GetIsUndoEnabled(a.Uid)); cl.Undo(a.Uid); Assert.AreEqual(true, cl.GetIsUndoEnabled(a.Uid)); cl.Undo(a.Uid); Assert.AreEqual(false, cl.GetIsUndoEnabled(a.Uid)); }
public void GetIsUndoEnabledAfterChangesAndUndo() { var cl = new TstClient(); var a = cl.GetRoot <RootVM>().AItems.First(); a.Value = 10; Assert.AreEqual(true, cl.GetIsUndoEnabled(a.Uid)); a.Value = 20; Assert.AreEqual(true, cl.GetIsUndoEnabled(a.Uid)); cl.Undo(a.Uid); Assert.AreEqual(true, cl.GetIsUndoEnabled(a.Uid)); cl.Undo(a.Uid); Assert.AreEqual(false, cl.GetIsUndoEnabled(a.Uid)); }
public void Undo2() { var cl = new TstClient(); var rt = cl.GetRoot <Root>(); var cnt = rt.AItems.Count; var a = new A { Value = 1 }; rt.AItems.Add(a); a.Value = 2; cl.Undo(rt.Uid); Assert.AreEqual(1, a.Value); cl.Undo(rt.Uid); Assert.AreEqual(cnt, rt.AItems.Count); }
public void Undo3() { var cl = new TstClient(); var rt = cl.GetRoot<Root>(); var cnt = rt.AItems.Count; rt.AItems.Add(new A {Value = 99}); rt.AItems.Last().Value = 100; rt.AItems.Add(new A {Value = 101}); cl.Undo(rt.Uid); Assert.AreEqual(cnt + 1, rt.AItems.Count); Assert.AreEqual(100, rt.AItems.Last().Value); cl.Undo(rt.Uid); Assert.AreEqual(99, rt.AItems.Last().Value); cl.Undo(rt.Uid); Assert.AreEqual(cnt, rt.AItems.Count); }
public void ListRedo1() { var cl = new TstClient(); var root = cl.GetRoot<Root>(); var cnt = root.AItems.Count; root.AItems.Add(new A {Value = 5}); root.AItems.Last().Value = 10; cl.Undo(root.Uid); Assert.AreEqual(5, root.AItems.Last().Value); cl.Undo(root.Uid); Assert.AreEqual(cnt, root.AItems.Count); cl.Redo(root.Uid); Assert.AreEqual(cnt + 1, root.AItems.Count); Assert.AreEqual(5, root.AItems.Last().Value); cl.Redo(root.Uid); Assert.AreEqual(10, root.AItems.Last().Value); }
public void AddUpdateAndRedo() { var cl = new TstClient(); var root = cl.GetRoot<Root>(); var cnt = root.BItems.Count; root.BItems.Add(new B {Value = "A"}); root.BItems.Last().Value = "AA"; cl.Undo(root.Uid); Assert.AreEqual("A", root.BItems.Last().Value); Assert.AreEqual(cnt + 1, root.BItems.Count); cl.Undo(root.Uid); Assert.AreEqual(cnt, root.BItems.Count); cl.Redo(root.Uid); Assert.AreEqual("A", root.BItems.Last().Value); Assert.AreEqual(cnt + 1, root.BItems.Count); cl.Redo(root.Uid); Assert.AreEqual("AA", root.BItems.Last().Value); }
public void Undo() { var cl = new TstClient(); var pr = cl.GetRoot<Root>().ParentItems.First(); var clientSideChild = new Child {Value = 3.0}; pr.Children.Add(clientSideChild); cl.Undo(pr.Uid); Assert.AreEqual(2, pr.Children.Count); }
public void RemoveAndUndoList() { var cl1 = new TstClient(); var rt1 = cl1.GetRoot <Root>(); var cl2 = new TstClient(); var rt2 = cl2.GetRoot <Root>(); var cnt = rt1.AItems.Count; rt1.AItems.Remove(rt1.AItems.First()); rt2.AItems.Remove(rt2.AItems.First()); cl1.Save(rt1.Uid); Wait(100, () => rt1.IsDirty); cl2.Undo(rt2.Uid); Assert.AreEqual(cnt, rt2.AItems.Count); cl2.Undo(rt2.Uid); Assert.AreEqual(rt1.AItems.Count, rt2.AItems.Count); }
public void GetIsRedoEnabled0() { var cl = new TstClient(); var a = cl.GetRoot<Root>().AItems.First(); a.Value = 10; cl.Undo(a.Uid); Assert.AreEqual(true, cl.GetIsRedoEnabled(a.Uid)); cl.Redo(a.Uid); Assert.AreEqual(false, cl.GetIsRedoEnabled(a.Uid)); }
public void RemoveAndUndoList() { var cl1 = new TstClient(); var rt1 = cl1.GetRoot<Root>(); var cl2 = new TstClient(); var rt2 = cl2.GetRoot<Root>(); var cnt = rt1.AItems.Count; rt1.AItems.Remove(rt1.AItems.First()); rt2.AItems.Remove(rt2.AItems.First()); cl1.Save(rt1.Uid); Wait(100, () => rt1.IsDirty); cl2.Undo(rt2.Uid); Assert.AreEqual(cnt, rt2.AItems.Count); cl2.Undo(rt2.Uid); Assert.AreEqual(rt1.AItems.Count, rt2.AItems.Count); }
public void AddAndUndoList() { var cl1 = new TstClient(); var rt1 = cl1.GetRoot<Root>(); var cl2 = new TstClient(); var rt2 = cl2.GetRoot<Root>(); var aValue = rt1.AItems.Last().Value; rt1.AItems.Add(new A {Value = 100}); rt2.AItems.Add(new A {Value = 200}); cl1.Save(rt1.Uid); Wait(100, () => rt1.IsDirty); cl2.Undo(rt2.Uid); Assert.AreEqual(aValue, rt2.AItems.Last().Value); cl2.Undo(rt2.Uid); Assert.AreEqual(rt1.AItems.Count, rt2.AItems.Count); Assert.AreEqual(rt1.AItems.Last().Value, rt2.AItems.Last().Value); }
public void Undo1() { var cl = new TstClient(); var rt = cl.GetRoot<Root>(); var cnt = rt.AItems.Count; rt.AItems.Add(new A {Value = 1}); Assert.IsTrue(cl.GetIsUndoEnabled(rt.Uid)); cl.Undo(rt.Uid); Assert.AreEqual(cnt, rt.AItems.Count); Assert.IsFalse(cl.GetIsUndoEnabled(rt.Uid)); }
public void GetIsRedoEnabled0() { var cl = new TstClient(); var a = cl.GetRoot <Root>().AItems.First(); a.Value = 10; cl.Undo(a.Uid); Assert.AreEqual(true, cl.GetIsRedoEnabled(a.Uid)); cl.Redo(a.Uid); Assert.AreEqual(false, cl.GetIsRedoEnabled(a.Uid)); }
public void ListRedo1() { var cl = new TstClient(); var root = cl.GetRoot <Root>(); var cnt = root.AItems.Count; root.AItems.Add(new A { Value = 5 }); root.AItems.Last().Value = 10; cl.Undo(root.Uid); Assert.AreEqual(5, root.AItems.Last().Value); cl.Undo(root.Uid); Assert.AreEqual(cnt, root.AItems.Count); cl.Redo(root.Uid); Assert.AreEqual(cnt + 1, root.AItems.Count); Assert.AreEqual(5, root.AItems.Last().Value); cl.Redo(root.Uid); Assert.AreEqual(10, root.AItems.Last().Value); }
public void AddUpdateAndRedo() { var cl = new TstClient(); var root = cl.GetRoot <Root>(); var cnt = root.BItems.Count; root.BItems.Add(new B { Value = "A" }); root.BItems.Last().Value = "AA"; cl.Undo(root.Uid); Assert.AreEqual("A", root.BItems.Last().Value); Assert.AreEqual(cnt + 1, root.BItems.Count); cl.Undo(root.Uid); Assert.AreEqual(cnt, root.BItems.Count); cl.Redo(root.Uid); Assert.AreEqual("A", root.BItems.Last().Value); Assert.AreEqual(cnt + 1, root.BItems.Count); cl.Redo(root.Uid); Assert.AreEqual("AA", root.BItems.Last().Value); }
public void Undo() { var cl = new TstClient(); var pr = cl.GetRoot <Root>().ParentItems.First(); var clientSideChild = new Child { Value = 3.0 }; pr.Children.Add(clientSideChild); cl.Undo(pr.Uid); Assert.AreEqual(2, pr.Children.Count); }
public void Undo3() { var cl = new TstClient(); var rt = cl.GetRoot <Root>(); var cnt = rt.AItems.Count; rt.AItems.Add(new A { Value = 99 }); rt.AItems.Last().Value = 100; rt.AItems.Add(new A { Value = 101 }); cl.Undo(rt.Uid); Assert.AreEqual(cnt + 1, rt.AItems.Count); Assert.AreEqual(100, rt.AItems.Last().Value); cl.Undo(rt.Uid); Assert.AreEqual(99, rt.AItems.Last().Value); cl.Undo(rt.Uid); Assert.AreEqual(cnt, rt.AItems.Count); }
public void Redo() { var cl = new TstClient(); var pr = cl.GetRoot<Root>().ParentItems.First(); var child = new Child {Value = 3.0}; var cnt = pr.Children.Count; pr.Children.Add(child); cl.Undo(pr.Uid); Assert.AreEqual(cnt, pr.Children.Count); cl.Redo(pr.Uid); Assert.AreEqual(true, pr.Children.SingleOrDefault(_child => _child.Uid == child.Uid) != null); }
public void ListRedo() { var cl = new TstClient(); var root = cl.GetRoot<Root>(); var cnt = root.AItems.Count; root.AItems.Add(new A()); cl.Undo(root.Uid); Assert.AreEqual(cnt, root.AItems.Count); cl.Redo(root.Uid); Assert.AreEqual(cnt + 1, root.AItems.Count); }
public void SaveAndUndo2() { var cl1 = new TstClient(); var rt1 = cl1.GetRoot <Root>(); var cl2 = new TstClient(); var rt2 = cl2.GetRoot <Root>(); var a1 = rt1.AItems.First(); var a2 = rt2.AItems.First(); var val = a1.Value; a2.Value = val + 2; a1.Value = val + 1; cl1.Save(a1); Assert.AreEqual(val + 2, a2.Value); cl2.Undo(a2); Assert.AreEqual(val, a2.Value); cl2.Undo(a2); Assert.AreEqual(val + 1, a2.Value); Assert.IsFalse(cl2.GetIsUndoEnabled(a2.Uid)); }
public void GetRefIsRedoEnabledChanged() { var cl = new TstClient(); var root = cl.GetRoot<Root>(); root.Revert(); var refObject = root.RefItems.First(); var a = refObject.Ref; Assert.AreEqual(false, cl.GetIsRedoEnabled(root)); Assert.AreEqual(false, cl.GetIsRedoEnabled(refObject)); a.Value = 9; cl.Undo(a); Assert.AreEqual(false, cl.GetIsRedoEnabled(refObject)); Assert.AreEqual(true, cl.GetIsRedoEnabled(root)); }
public void GetParentIsRedoEnabledChanged() { var cl = new TstClient(); var root = cl.GetRoot<Root>(); root.Revert(); var prnt = root.ParentItems.First(); var chld = prnt.Children.First(); Assert.AreEqual(false, cl.GetIsRedoEnabled(root)); Assert.AreEqual(false, cl.GetIsRedoEnabled(prnt)); chld.Value = 9.9; cl.Undo(chld); Assert.AreEqual(true, cl.GetIsRedoEnabled(prnt)); Assert.AreEqual(true, cl.GetIsRedoEnabled(root)); }
public void Undo1() { var cl = new TstClient(); var rt = cl.GetRoot <Root>(); var cnt = rt.AItems.Count; rt.AItems.Add(new A { Value = 1 }); Assert.IsTrue(cl.GetIsUndoEnabled(rt.Uid)); cl.Undo(rt.Uid); Assert.AreEqual(cnt, rt.AItems.Count); Assert.IsFalse(cl.GetIsUndoEnabled(rt.Uid)); }
public void Redo() { var cl = new TstClient(); var pr = cl.GetRoot <Root>().ParentItems.First(); var child = new Child { Value = 3.0 }; var cnt = pr.Children.Count; pr.Children.Add(child); cl.Undo(pr.Uid); Assert.AreEqual(cnt, pr.Children.Count); cl.Redo(pr.Uid); Assert.AreEqual(true, pr.Children.SingleOrDefault(_child => _child.Uid == child.Uid) != null); }
public void ListRedo() { var cl = new TstClient(); var root = cl.GetRoot <Root>(); var cnt = root.AItems.Count; root.AItems.Add(new A()); cl.Undo(root.Uid); Assert.AreEqual(cnt, root.AItems.Count); cl.Redo(root.Uid); Assert.AreEqual(cnt + 1, root.AItems.Count); }
public void AddAndUndoList() { var cl1 = new TstClient(); var rt1 = cl1.GetRoot <Root>(); var cl2 = new TstClient(); var rt2 = cl2.GetRoot <Root>(); var aValue = rt1.AItems.Last().Value; rt1.AItems.Add(new A { Value = 100 }); rt2.AItems.Add(new A { Value = 200 }); cl1.Save(rt1.Uid); Wait(100, () => rt1.IsDirty); cl2.Undo(rt2.Uid); Assert.AreEqual(aValue, rt2.AItems.Last().Value); cl2.Undo(rt2.Uid); Assert.AreEqual(rt1.AItems.Count, rt2.AItems.Count); Assert.AreEqual(rt1.AItems.Last().Value, rt2.AItems.Last().Value); }
public void GetRefIsRedoEnabledChanged() { var cl = new TstClient(); var root = cl.GetRoot <Root>(); root.Revert(); var refObject = root.RefItems.First(); var a = refObject.Ref; Assert.AreEqual(false, cl.GetIsRedoEnabled(root)); Assert.AreEqual(false, cl.GetIsRedoEnabled(refObject)); a.Value = 9; cl.Undo(a); Assert.AreEqual(false, cl.GetIsRedoEnabled(refObject)); Assert.AreEqual(true, cl.GetIsRedoEnabled(root)); }
public void GetParentIsRedoEnabledChanged() { var cl = new TstClient(); var root = cl.GetRoot <Root>(); root.Revert(); var prnt = root.ParentItems.First(); var chld = prnt.Children.First(); Assert.AreEqual(false, cl.GetIsRedoEnabled(root)); Assert.AreEqual(false, cl.GetIsRedoEnabled(prnt)); chld.Value = 9.9; cl.Undo(chld); Assert.AreEqual(true, cl.GetIsRedoEnabled(prnt)); Assert.AreEqual(true, cl.GetIsRedoEnabled(root)); }
public void ChangeAMirror() { var cl = new TstClient(); var rf = cl.GetRoot<Root>().RefItems.First(); Assert.AreEqual(cl.GetRoot<Root>().AItems.First(), rf.Ref); var a2 = cl.GetRoot<Root>().AItems.ToList()[1]; rf.Ref = a2; var rfm = cl.Get<RefMirror>(rf.Uid); Assert.AreEqual(rfm.Ref, rf.Ref); Assert.AreEqual(rfm.IsDirty, true); cl.Undo(rf.Uid); Assert.AreEqual(cl.GetRoot<Root>().AItems.First(), rf.Ref); Assert.AreEqual(cl.GetRoot<Root>().AItems.First(), rfm.Ref); }
public void SaveAndUndo() { var cl1 = new TstClient(); var rt1 = cl1.GetRoot <Root>(); var cl2 = new TstClient(); var rt2 = cl2.GetRoot <Root>(); Assert.AreEqual(rt1.RefItems.First().Ref, rt1.AItems.First()); Assert.AreNotEqual(rt1.RefItems.First().Ref, rt1.AItems.ToList()[1]); rt1.RefItems.First().Ref = rt1.AItems.ToList()[1]; rt2.RefItems.First().Ref = rt2.AItems.ToList()[1]; cl1.Save(rt1); cl2.Undo(rt2); Assert.AreEqual(rt2.RefItems.First().Ref.Uid, rt2.AItems.First().Uid); Assert.AreEqual(rt2.RefItems.First().Ref, rt2.AItems.First()); }
public void SaveAndUndo() { var cl1 = new TstClient(); var rt1 = cl1.GetRoot<Root>(); var cl2 = new TstClient(); var rt2 = cl2.GetRoot<Root>(); Assert.AreEqual(rt1.RefItems.First().Ref, rt1.AItems.First()); Assert.AreNotEqual(rt1.RefItems.First().Ref, rt1.AItems.ToList()[1]); rt1.RefItems.First().Ref = rt1.AItems.ToList()[1]; rt2.RefItems.First().Ref = rt2.AItems.ToList()[1]; cl1.Save(rt1); cl2.Undo(rt2); Assert.AreEqual(rt2.RefItems.First().Ref.Uid, rt2.AItems.First().Uid); Assert.AreEqual(rt2.RefItems.First().Ref, rt2.AItems.First()); }
public void ChangeAMirror() { var cl = new TstClient(); var rf = cl.GetRoot <Root>().RefItems.First(); Assert.AreEqual(cl.GetRoot <Root>().AItems.First(), rf.Ref); var a2 = cl.GetRoot <Root>().AItems.ToList()[1]; rf.Ref = a2; var rfm = cl.Get <RefMirror>(rf.Uid); Assert.AreEqual(rfm.Ref, rf.Ref); Assert.AreEqual(rfm.IsDirty, true); cl.Undo(rf.Uid); Assert.AreEqual(cl.GetRoot <Root>().AItems.First(), rf.Ref); Assert.AreEqual(cl.GetRoot <Root>().AItems.First(), rfm.Ref); }
public void SaveAndUndo2() { var cl1 = new TstClient(); var rt1 = cl1.GetRoot<Root>(); var cl2 = new TstClient(); var rt2 = cl2.GetRoot<Root>(); var a1 = rt1.AItems.First(); var a2 = rt2.AItems.First(); var val = a1.Value; a2.Value = val + 2; a1.Value = val + 1; cl1.Save(a1); Assert.AreEqual(val + 2, a2.Value); cl2.Undo(a2); Assert.AreEqual(val, a2.Value); cl2.Undo(a2); Assert.AreEqual(val + 1, a2.Value); Assert.IsFalse(cl2.GetIsUndoEnabled(a2.Uid)); }