Skip to content

Commit 79abb1a

Browse files
Merge pull request #67 from OmniSharp/fix/registration
missed tests (I'm slow)
2 parents 6d550ee + 6919063 commit 79abb1a

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

test/Lsp.Tests/HandlerResolverTests.cs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ public void Should_Contain_AllDefinedMethods_OnLanguageServer(Type requestHandle
134134
var sub = (IJsonRpcHandler)Substitute.For(new Type[] { requestHandler, type2 }, new object[0]);
135135
if (sub is IRegistration<TextDocumentRegistrationOptions> reg)
136136
reg.GetRegistrationOptions()
137-
.Returns(new TextDocumentRegistrationOptions()
138-
{
137+
.Returns(new TextDocumentRegistrationOptions() {
139138
DocumentSelector = new DocumentSelector()
140139
});
141140
handler.Add(sub);
@@ -152,15 +151,13 @@ public void Should_Contain_AllDefinedMethods_OnLanguageServer_WithDifferentKeys(
152151
var sub = (IJsonRpcHandler)Substitute.For(new Type[] { requestHandler, type2 }, new object[0]);
153152
if (sub is IRegistration<TextDocumentRegistrationOptions> reg)
154153
reg.GetRegistrationOptions()
155-
.Returns(new TextDocumentRegistrationOptions()
156-
{
157-
DocumentSelector = new DocumentSelector()
154+
.Returns(new TextDocumentRegistrationOptions() {
155+
DocumentSelector = new DocumentSelector() { }
158156
});
159157
var sub2 = (IJsonRpcHandler)Substitute.For(new Type[] { requestHandler, type2 }, new object[0]);
160158
if (sub2 is IRegistration<TextDocumentRegistrationOptions> reg2)
161159
reg2.GetRegistrationOptions()
162-
.Returns(new TextDocumentRegistrationOptions()
163-
{
160+
.Returns(new TextDocumentRegistrationOptions() {
164161
DocumentSelector = new DocumentSelector()
165162
});
166163
handler.Add(sub);
@@ -197,10 +194,29 @@ public void Should_DealWithClassesThatImplementMultipleHandlers_WithoutConflicti
197194

198195
public static IEnumerable<object[]> Should_DealWithClassesThatImplementMultipleHandlers_WithoutConflictingRegistrations_Data()
199196
{
200-
yield return new object[] {
201-
DocumentNames.CodeLensResolve,
202-
Substitute.For(new Type[] { typeof(ICodeLensHandler), typeof(ICodeLensResolveHandler) }, new object[0])
203-
};
197+
var codeLensHandler = Substitute.For(new Type[] { typeof(ICodeLensHandler), typeof(ICodeLensResolveHandler) }, new object[0]);
198+
((ICodeLensHandler)codeLensHandler).GetRegistrationOptions()
199+
.Returns(new CodeLensRegistrationOptions() {
200+
DocumentSelector = new DocumentSelector() { }
201+
});
202+
203+
yield return new object[] { DocumentNames.CodeLensResolve, codeLensHandler };
204+
205+
var documentLinkHandler = Substitute.For(new Type[] { typeof(IDocumentLinkHandler), typeof(IDocumentLinkResolveHandler) }, new object[0]);
206+
((IDocumentLinkHandler)documentLinkHandler).GetRegistrationOptions()
207+
.Returns(new DocumentLinkRegistrationOptions() {
208+
DocumentSelector = new DocumentSelector() { }
209+
});
210+
211+
yield return new object[] { DocumentNames.DocumentLinkResolve, documentLinkHandler };
212+
213+
var completionHandler = Substitute.For(new Type[] { typeof(ICompletionHandler), typeof(ICompletionResolveHandler) }, new object[0]);
214+
((ICompletionHandler)completionHandler).GetRegistrationOptions()
215+
.Returns(new CompletionRegistrationOptions() {
216+
DocumentSelector = new DocumentSelector() { }
217+
});
218+
219+
yield return new object[] { DocumentNames.CompletionResolve, completionHandler };
204220
}
205221
}
206222
}

0 commit comments

Comments
 (0)