Skip to content

Commit 04188ee

Browse files
committed
Add test for #60.
1 parent e136c53 commit 04188ee

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/Lsp.Tests/LspRequestRouterTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
1717
using OmniSharp.Extensions.LanguageServer.Server;
1818
using OmniSharp.Extensions.LanguageServer.Server.Abstractions;
19+
using OmniSharp.Extensions.LanguageServer.Server.Handlers;
1920
using Xunit;
2021
using Xunit.Abstractions;
2122
using Xunit.Sdk;
@@ -144,5 +145,29 @@ public async Task ShouldRouteToCorrect_Request_WithManyHandlers()
144145
await codeActionHandler.Received(1).Handle(Arg.Any<CodeActionParams>(), Arg.Any<CancellationToken>());
145146
await codeActionHandler2.Received(0).Handle(Arg.Any<CodeActionParams>(), Arg.Any<CancellationToken>());
146147
}
148+
149+
[Fact]
150+
public async Task ShouldHandle_Request_WithNullParameters()
151+
{
152+
bool wasShutDown = false;
153+
154+
ShutdownHandler shutdownHandler = new ShutdownHandler();
155+
shutdownHandler.Shutdown += shutdownRequested =>
156+
{
157+
wasShutDown = true;
158+
};
159+
160+
var collection = new HandlerCollection { shutdownHandler };
161+
var mediator = new LspRequestRouter(collection, _testLoggerFactory, _handlerMatcherCollection, new Serializer());
162+
163+
object @params = null;
164+
165+
var id = Guid.NewGuid().ToString();
166+
var request = new Request(id, GeneralNames.Shutdown, JValue.CreateNull());
167+
168+
await mediator.RouteRequest(mediator.GetDescriptor(request), request);
169+
170+
Assert.True(wasShutDown, "WasShutDown");
171+
}
147172
}
148173
}

0 commit comments

Comments
 (0)