public void FormatDocument02() { string content = "\r\nif(x<1){x<-2}"; ITextBuffer textBuffer = new TextBufferMock(content, RContentTypeDefinition.ContentType); ITextView textView = new TextViewMock(textBuffer); using (var command = new FormatDocumentCommand(textView, textBuffer)) { var status = command.Status(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.FORMATDOCUMENT); status.Should().Be(CommandStatus.SupportedAndEnabled); object o = new object(); command.Invoke(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.FORMATDOCUMENT, null, ref o); } string actual = textBuffer.CurrentSnapshot.GetText(); actual.Should().Be("\r\nif (x < 1) {\r\n x <- 2\r\n}"); }
public void FormatDocument(string original, string expected) { ITextBuffer textBuffer = new TextBufferMock(original, RContentTypeDefinition.ContentType); ITextView textView = new TextViewMock(textBuffer); using (var command = new FormatDocumentCommand(textView, textBuffer, _editorShell)) { var status = command.Status(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.FORMATDOCUMENT); status.Should().Be(CommandStatus.SupportedAndEnabled); object o = new object(); command.Invoke(VSConstants.VSStd2K, (int)VSConstants.VSStd2KCmdID.FORMATDOCUMENT, null, ref o); } string actual = textBuffer.CurrentSnapshot.GetText(); actual.Should().Be(expected); }