-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from gep13/issue-136
(GH-136) Corrected IRegistration definition
- Loading branch information
Showing
5 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
test/Lsp.Tests/Models/CodeActionRegistrationOptionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using FluentAssertions; | ||
using Newtonsoft.Json; | ||
using OmniSharp.Extensions.LanguageServer.Protocol; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Models; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization; | ||
using Xunit; | ||
|
||
namespace Lsp.Tests.Models | ||
{ | ||
public class CodeActionRegistrationOptionsTests | ||
{ | ||
[Theory, JsonFixture] | ||
public void SimpleTest(string expected) | ||
{ | ||
var model = new CodeActionRegistrationOptions() { | ||
DocumentSelector = new DocumentSelector(new[] { new DocumentFilter(){ | ||
Language = "csharp", | ||
Pattern = "pattern", | ||
Scheme = "scheme" | ||
}, new DocumentFilter(){ | ||
Language = "vb", | ||
Pattern = "pattern", | ||
Scheme = "scheme" | ||
} }), | ||
CodeActionKinds = new[] { | ||
CodeActionKind.QuickFix, | ||
CodeActionKind.Refactor, | ||
CodeActionKind.RefactorExtract, | ||
CodeActionKind.RefactorInline, | ||
CodeActionKind.RefactorRewrite, | ||
CodeActionKind.Source, | ||
CodeActionKind.SourceOrganizeImports | ||
} | ||
}; | ||
var result = Fixture.SerializeObject(model); | ||
|
||
result.Should().Be(expected); | ||
|
||
var deresult = new Serializer(ClientVersion.Lsp3).DeserializeObject<CodeActionRegistrationOptions>(expected); | ||
deresult.Should().BeEquivalentTo(model); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
test/Lsp.Tests/Models/CodeActionRegistrationOptionsTests_$SimpleTest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"codeActionKinds": [ | ||
"quickfix", | ||
"refactor", | ||
"refactor.extract", | ||
"refactor.inline", | ||
"refactor.rewrite", | ||
"source", | ||
"source.organizeImports" | ||
], | ||
"documentSelector": [ | ||
{ | ||
"language": "csharp", | ||
"scheme": "scheme", | ||
"pattern": "pattern" | ||
}, | ||
{ | ||
"language": "vb", | ||
"scheme": "scheme", | ||
"pattern": "pattern" | ||
} | ||
] | ||
} |