Esempio n. 1
0
        public void SimilarStringsDontGetStacked()
        {
            var stack = new StringHistoryStack();

            stack.Stack("titi", 0, 4);
            stack.Stack("titi", 0, 2);
            stack.Stack("titi", 1, 4);

            stack.ShouldBe(new HistoryStackItem[] {
                new HistoryStackItem(string.Empty, 0, 0),
                new HistoryStackItem("titi", 0, 4)
            });
        }
Esempio n. 2
0
        public void HistoryGetsStacked()
        {
            var stack = new StringHistoryStack();

            stack.Stack("titi", 0, 4);
            stack.Stack("toto", 0, 4);
            stack.Stack("tata", 0, 4);

            stack.ShouldBe(new HistoryStackItem[] {
                new HistoryStackItem(string.Empty, 0, 0),
                new HistoryStackItem("titi", 0, 4),
                new HistoryStackItem("toto", 0, 4),
                new HistoryStackItem("tata", 0, 4),
            });
            stack.Current.ShouldBe(new HistoryStackItem("tata", 0, 4));
        }
Esempio n. 3
0
        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)
            });
        }