public void RemoveAt_WhenCalledAndReverted_RemovesAndReverts() { TrackedCollection <int> tc = new TrackedCollection <int>(CollectionTrackingStrategy.TrackOnlyCollectionOperations); tc.Tracker.Track(); tc.Add(0); tc.Add(1); tc.Add(2); tc.RemoveAt(1); Assert.IsFalse(tc.Contains(1)); Assert.IsTrue(tc[1] == 2); tc.Tracker.Undo(); Assert.IsTrue(tc[1] == 1); Assert.IsTrue(tc.Contains(1)); }
public void Insert_WhenCalledAndReverted_InsertsAndReverts() { TrackedCollection<int> tc = new TrackedCollection<int>(CollectionTrackingStrategy.TrackOnlyCollectionOperations); tc.Tracker.Track(); tc.Add(0); tc.Add(1); tc.Add(2); tc.Insert(0, 10); Assert.IsTrue(tc[0] == 10); tc.Tracker.Undo(); Assert.IsTrue(tc[0] == 0); Assert.IsFalse(tc.Contains( 10 )); }
public void Insert_WhenCalledAndReverted_InsertsAndReverts() { TrackedCollection <int> tc = new TrackedCollection <int>(CollectionTrackingStrategy.TrackOnlyCollectionOperations); tc.Tracker.Track(); tc.Add(0); tc.Add(1); tc.Add(2); tc.Insert(0, 10); Assert.IsTrue(tc[0] == 10); tc.Tracker.Undo(); Assert.IsTrue(tc[0] == 0); Assert.IsFalse(tc.Contains(10)); }
public void RemoveAt_WhenCalledAndReverted_RemovesAndReverts() { TrackedCollection<int> tc = new TrackedCollection<int>(CollectionTrackingStrategy.TrackOnlyCollectionOperations); tc.Tracker.Track(); tc.Add(0); tc.Add(1); tc.Add(2); tc.RemoveAt(1); Assert.IsFalse(tc.Contains(1)); Assert.IsTrue(tc[1] == 2); tc.Tracker.Undo(); Assert.IsTrue(tc[1] == 1); Assert.IsTrue(tc.Contains(1)); }