Exemple #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)
            });
        }
Exemple #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));
        }
Exemple #3
0
        public PasswordTextBox(IPasswordHelper passwordHelper, IHistoryService historyService)
        {
            PasswordHelper = passwordHelper;
            HistoryService = historyService;

            UnmaskedConnectionString = string.Empty;
            Text  = string.Empty;
            stack = new StringHistoryStack(string.Empty, 0, 0);

            Handlers = new List <IEventHandler>();

            AutoCompleteMode   = AutoCompleteMode.Suggest;
            AutoCompleteSource = AutoCompleteSource.CustomSource;

            KeyPress    += OnKeyPressedInternal;
            TextChanged += TextChangedInternal;
        }
Exemple #4
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)
            });
        }
Exemple #5
0
        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));
        }