Пример #1
0
        public void Should_Return_Handler_Descriptor()
        {
            // Given
            var handlerMatcher        = new ExecuteCommandMatcher(_logger);
            var executeCommandHandler = Substitute.For <IExecuteCommandHandler>().With(new Container <string>("Command"));

            // When
            var result = handlerMatcher.FindHandler(new ExecuteCommandParams {
                Command = "Command"
            },
                                                    new List <HandlerDescriptor> {
                new HandlerDescriptor("workspace/executeCommand",
                                      "Key",
                                      executeCommandHandler,
                                      executeCommandHandler.GetType(),
                                      typeof(ExecuteCommandParams),
                                      typeof(ExecuteCommandRegistrationOptions),
                                      typeof(ExecuteCommandCapability),
                                      () => { })
            });

            // Then
            result.Should().NotBeNullOrEmpty();
            result.Should().Contain(x => x.Method == "workspace/executeCommand");
        }
Пример #2
0
        public void Should_Return_Empty_Descriptor()
        {
            // Given
            var handlerDescriptors = Enumerable.Empty <ILspHandlerDescriptor>();
            var handlerMatcher     = new ExecuteCommandMatcher(_logger);

            // When
            var result = handlerMatcher.FindHandler(1, handlerDescriptors);

            // Then
            result.Should().BeEmpty();
        }