public void RollBackPastFirstValue() { var storage = new ValueHistory <int>(); int maximumValue = 10; for (int i = 1; i < maximumValue; i++) { storage.Current = i; storage.StoreCurrent(new TimeMarker((ulong)(i + 1))); } storage.RollBackTo(new TimeMarker(0)); int storedValue = storage; Assert.AreEqual(0, storedValue); }
public void RollForwardPastLastValue() { var storage = new ValueHistory <int>(); int maximumValue = 10; for (int i = 0; i < maximumValue; i++) { storage.Current = i; storage.StoreCurrent(new TimeMarker((ulong)(i + 1))); } storage.RollBackTo(new TimeMarker(5)); storage.RollForwardTo(new TimeMarker((ulong)(maximumValue + 1))); int storedValue = storage; Assert.AreEqual(maximumValue - 1, storedValue); }
public void RollBackToPreviousValue() { var storage = new ValueHistory <int>(); int maximumValue = 10; for (int i = 0; i < maximumValue; i++) { storage.Current = i; storage.StoreCurrent(new TimeMarker((ulong)(i + 1))); } for (int i = maximumValue; i > 0; i--) { storage.RollBackTo(new TimeMarker((ulong)i)); int storedValue = storage; Assert.AreEqual(i - 1, storedValue); } }