public void Should_DealWithClassesThatImplementMultipleHandlers_BySettingKeyAccordingly() { var codeLensHandler = Substitute.For(new Type[] { typeof(ICodeLensHandler), typeof(ICodeLensResolveHandler) }, new object[0]); ((ICodeLensHandler)codeLensHandler).GetRegistrationOptions() .Returns(new CodeLensRegistrationOptions() { DocumentSelector = new DocumentSelector(DocumentFilter.ForLanguage("foo")) }); var handler = new SharedHandlerCollection(SupportedCapabilitiesFixture.AlwaysTrue, new TextDocumentIdentifiers()); handler.Add(codeLensHandler as IJsonRpcHandler); var descriptor = handler._handlers.Select(x => x.Key); descriptor.Should().BeEquivalentTo(new [] { "[foo]", "[foo]" }); }
public void Should_DealWithClassesThatImplementMultipleHandlers_BySettingKeyAccordingly() { var codeLensHandler = Substitute.For(new[] { typeof(ICodeLensHandler), typeof(ICodeLensResolveHandler) }, new object[0]); ((ICodeLensHandler)codeLensHandler).GetRegistrationOptions() .Returns( new CodeLensRegistrationOptions { DocumentSelector = new DocumentSelector(DocumentFilter.ForLanguage("foo")) } ); var handler = new SharedHandlerCollection(SupportedCapabilitiesFixture.AlwaysTrue, new TextDocumentIdentifiers(), Substitute.For <IResolverContext>(), new LspHandlerTypeDescriptorProvider(new [] { typeof(FoundationTests).Assembly, typeof(LanguageServer).Assembly, typeof(LanguageClient).Assembly, typeof(IRegistrationManager).Assembly, typeof(LspRequestRouter).Assembly })); handler.Add(codeLensHandler as IJsonRpcHandler); var descriptor = handler.OfType <LspHandlerDescriptor>().Select(x => x.Key); descriptor.Should().BeEquivalentTo("[foo]", "[foo]"); }