public void SavingInMiddleOfHistoryResetsComingOnes() { var stack = new StringHistoryStack(); stack.Stack("titi", 0, 4); stack.Stack("toto", 0, 4); stack.Stack("tata", 0, 4); stack.Undo(); stack.Undo(); stack.Stack("bidule", 0, 6); stack.ShouldBe(new HistoryStackItem[] { new HistoryStackItem(string.Empty, 0, 0), new HistoryStackItem("titi", 0, 4), new HistoryStackItem("bidule", 0, 6) }); }
public void StringCanBeRedone() { var stack = new StringHistoryStack(); stack.Stack("titi", 0, 4); stack.Stack("toto", 0, 4); stack.Stack("tata", 0, 4); stack.Undo(); stack.Undo().ShouldBe(new HistoryStackItem("titi", 0, 4)); stack.Current.ShouldBe(new HistoryStackItem("titi", 0, 4)); stack.Undo().ShouldBe(new HistoryStackItem(string.Empty, 0, 0)); stack.Current.ShouldBe(new HistoryStackItem(string.Empty, 0, 0)); stack.Undo().ShouldBe(new HistoryStackItem(string.Empty, 0, 0)); stack.Current.ShouldBe(new HistoryStackItem(string.Empty, 0, 0)); }