diff --git a/src/EditorFeatures/CSharpTest/DocumentationComments/DocumentationCommentTests.cs b/src/EditorFeatures/CSharpTest/DocumentationComments/DocumentationCommentTests.cs index 2e9c6ab00640c34070fa1e1f0d3b5d65a7c8f78c..f7eab157089e8e50ceb16b9ac0ec5755a8a76d61 100644 --- a/src/EditorFeatures/CSharpTest/DocumentationComments/DocumentationCommentTests.cs +++ b/src/EditorFeatures/CSharpTest/DocumentationComments/DocumentationCommentTests.cs @@ -1338,6 +1338,126 @@ public Class1() VerifyTypingCharacter(code, expected, useTab: true); } + [WorkItem(2090, "https://github.com/dotnet/roslyn/issues/2090")] + [Fact, Trait(Traits.Feature, Traits.Features.DocumentationComments)] + public void TestOpenLineAbove1() + { + const string code = +@"class C +{ + /// + /// stuff$$ + /// + void M() + { + } +}"; + + var expected = +@"class C +{ + /// + /// $$ + /// stuff + /// + void M() + { + } +}"; + + VerifyOpenLineAbove(code, expected); + } + + [WorkItem(2090, "https://github.com/dotnet/roslyn/issues/2090")] + [Fact, Trait(Traits.Feature, Traits.Features.DocumentationComments)] + public void TestOpenLineAbove2() + { + const string code = +@"class C +{ + /// + /// $$stuff + /// + void M() + { + } +}"; + + const string expected = +@"class C +{ + /// + /// $$ + /// stuff + /// + void M() + { + } +}"; + + VerifyOpenLineAbove(code, expected); + } + + [WorkItem(2090, "https://github.com/dotnet/roslyn/issues/2090")] + [Fact, Trait(Traits.Feature, Traits.Features.DocumentationComments)] + public void TestOpenLineBelow1() + { + const string code = +@"class C +{ + /// + /// stuff$$ + /// + void M() + { + } +}"; + + const string expected = +@"class C +{ + /// + /// stuff + /// $$ + /// + void M() + { + } +}"; + + VerifyOpenLineBelow(code, expected); + } + + [WorkItem(2090, "https://github.com/dotnet/roslyn/issues/2090")] + [Fact, Trait(Traits.Feature, Traits.Features.DocumentationComments)] + public void TestOpenLineBelow2() + { + const string code = +@"class C +{ + /// + /// $$stuff + /// + void M() + { + } +}"; + + const string expected = +@"class C +{ + /// + /// stuff + /// $$ + /// + void M() + { + } +}"; + + VerifyOpenLineBelow(code, expected); + } + protected override char DocumentationCommentCharacter { get { return '/'; } diff --git a/src/EditorFeatures/Test/DocumentationComments/AbstractDocumentationCommentTests.cs b/src/EditorFeatures/Test/DocumentationComments/AbstractDocumentationCommentTests.cs index 44ca00f845d0d79802c2ec83872a2324a9100f5c..e3b4b661f686d45435ec2c0572a1bfd6f92becd2 100644 --- a/src/EditorFeatures/Test/DocumentationComments/AbstractDocumentationCommentTests.cs +++ b/src/EditorFeatures/Test/DocumentationComments/AbstractDocumentationCommentTests.cs @@ -64,6 +64,32 @@ protected void VerifyInsertCommentCommand(string initialMarkup, string expectedM }); } + protected void VerifyOpenLineAbove(string initialMarkup, string expectedMarkup) + { + Verify(initialMarkup, expectedMarkup, (view, undoHistoryRegistry, editorOperationsFactoryService, completionService) => + { + var commandHandler = CreateCommandHandler(TestWaitIndicator.Default, undoHistoryRegistry, editorOperationsFactoryService, completionService) as ICommandHandler; + + var commandArgs = new OpenLineAboveCommandArgs(view, view.TextBuffer); + Action nextHandler = delegate { }; + + commandHandler.ExecuteCommand(commandArgs, nextHandler); + }); + } + + protected void VerifyOpenLineBelow(string initialMarkup, string expectedMarkup) + { + Verify(initialMarkup, expectedMarkup, (view, undoHistoryRegistry, editorOperationsFactoryService, completionService) => + { + var commandHandler = CreateCommandHandler(TestWaitIndicator.Default, undoHistoryRegistry, editorOperationsFactoryService, completionService) as ICommandHandler; + + var commandArgs = new OpenLineBelowCommandArgs(view, view.TextBuffer); + Action nextHandler = delegate { }; + + commandHandler.ExecuteCommand(commandArgs, nextHandler); + }); + } + private Action CreateInsertTextHandler(ITextView textView, string text) { return () =>