public void TestUnCommentIndented() { var view = TextViewUtility.CreateTextView(Container, TextBufferUtility.CreateTextBuffer(Container, @"void f(){ //int i; //half h; float f; }")); view.Selection.Select( new SnapshotSpan( view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(1).Start, view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(2).End ), false ); view.Selection.IsActive = true; view.CommentOrUncommentBlock(false); Assert.Equal(@"void f(){ int i; half h; float f; }", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestCommentBlankLine() { var view = TextViewUtility.CreateTextView(Container, TextBufferUtility.CreateTextBuffer(Container, @"int i; float f;")); view.Caret.MoveTo(view.TextBuffer.CurrentSnapshot.GetLineFromLineNumber(1).Start); view.CommentOrUncommentBlock(true); Assert.Equal(@"int i; float f;", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestComment() { var view = TextViewUtility.CreateTextView(Container, TextBufferUtility.CreateTextBuffer(Container, @"int i; float f;")); view.Selection.Select( new SnapshotSpan(view.TextBuffer.CurrentSnapshot, new Span(0, view.TextBuffer.CurrentSnapshot.Length)), false ); view.Selection.IsActive = true; view.CommentOrUncommentBlock(true); Assert.Equal(@"//int i; //float f;", view.TextBuffer.CurrentSnapshot.GetText()); }
public void TestCommentAfterCodeIsNotUncommented() { var view = TextViewUtility.CreateTextView(Container, TextBufferUtility.CreateTextBuffer(Container, @"int i;//comment that should stay a comment; //half h;//another comment that should stay a comment; float f;")); view.Selection.Select( new SnapshotSpan(view.TextBuffer.CurrentSnapshot, new Span(0, view.TextBuffer.CurrentSnapshot.GetText().IndexOf("float f;"))), false ); view.Selection.IsActive = true; view.CommentOrUncommentBlock(false); Assert.Equal(@"int i;//comment that should stay a comment; half h;//another comment that should stay a comment; float f;", view.TextBuffer.CurrentSnapshot.GetText()); }