public void TestMove_invalid() { TextCursor cursor = MakeCursor("test"); ValidateBeginningOfString(cursor); Assert.False(cursor.Move(-1000)); ValidateBeginningOfString(cursor); Assert.False(cursor.Move(1000)); ValidateEndOfString(cursor); Assert.False(cursor.Move(-1000)); ValidateBeginningOfString(cursor); }
public void TestMove() { TextCursor cursor = MakeCursor("test"); ValidateBeginningOfString(cursor); Assert.True(cursor.Move(0)); ValidateCurrentCharacter(cursor, 0, 't'); Assert.True(cursor.Move(1)); ValidateCurrentCharacter(cursor, 1, 'e'); Assert.True(cursor.Move(2)); ValidateCurrentCharacter(cursor, 2, 's'); Assert.True(cursor.Move(3)); ValidateCurrentCharacter(cursor, 3, 't'); Assert.False(cursor.Move(4)); ValidateEndOfString(cursor); }
public void TestMove_NextPrevious() { TextCursor cursor = MakeCursor("test"); ValidateBeginningOfString(cursor); Assert.True(cursor.Move(2), "Move(2)"); ValidateCurrentCharacter(cursor, 2, 's'); Assert.True(cursor.MovePrevious(), "MovePrevious()"); ValidateCurrentCharacter(cursor, 1, 'e'); Assert.True(cursor.MoveNext(), "MoveNext()"); ValidateCurrentCharacter(cursor, 2, 's'); }