public void Insert(string value, int length) { var textInputBuffer = new TextInputBuffer(); foreach (var c in value) { textInputBuffer.Insert(c); } Assert.Equal(length, textInputBuffer.Length); Assert.Equal(value, textInputBuffer.ToString()); }
public void MoveBackward(string value, string backward, string forward) { var textInputBuffer = new TextInputBuffer(); foreach (var c in value) { textInputBuffer.Insert(c); } textInputBuffer.MoveBackward(); Assert.Equal(backward, textInputBuffer.ToBackwardString()); Assert.Equal(forward, textInputBuffer.ToForwardString()); }
public void Backspace(string value, string substring) { var textInputBuffer = new TextInputBuffer(); foreach (var c in value) { textInputBuffer.Insert(c); } textInputBuffer.Backspace(); Assert.Equal(substring, textInputBuffer.ToString()); Assert.Equal(substring, textInputBuffer.ToBackwardString()); Assert.Equal(string.Empty, textInputBuffer.ToForwardString()); }
public void Delete(string value, string substring) { var textInputBuffer = new TextInputBuffer(); foreach (var c in value) { textInputBuffer.Insert(c); } while (!textInputBuffer.IsStart) { textInputBuffer.MoveBackward(); } textInputBuffer.Delete(); Assert.Equal(substring, textInputBuffer.ToString()); Assert.Equal(string.Empty, textInputBuffer.ToBackwardString()); Assert.Equal(substring, textInputBuffer.ToForwardString()); }