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) }); }
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)); }
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; }
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)); }