@@ -54,6 +54,37 @@ public void Should_Return_Empty_Descriptor()
54
54
result . Should ( ) . BeEmpty ( ) ;
55
55
}
56
56
57
+ [ Fact ]
58
+ public void Should_Return_Did_Open_Text_Document_Handler_Descriptor_With_No_Registration_Options ( )
59
+ {
60
+ // Given
61
+ var textDocumentSyncHandler =
62
+ TextDocumentSyncHandlerExtensions . With ( null , "csharp" ) ;
63
+ var textDocumentIdentifiers = new TextDocumentIdentifiers ( ) ;
64
+ AutoSubstitute . Provide ( textDocumentIdentifiers ) ;
65
+ var collection = new SharedHandlerCollection ( SupportedCapabilitiesFixture . AlwaysTrue , textDocumentIdentifiers , Substitute . For < IResolverContext > ( ) ,
66
+ new LspHandlerTypeDescriptorProvider ( new [ ] { typeof ( FoundationTests ) . Assembly , typeof ( LanguageServer ) . Assembly , typeof ( LanguageClient ) . Assembly , typeof ( IRegistrationManager ) . Assembly , typeof ( LspRequestRouter ) . Assembly } ) )
67
+ { textDocumentSyncHandler } ;
68
+ AutoSubstitute . Provide < IHandlerCollection > ( collection ) ;
69
+ AutoSubstitute . Provide < IEnumerable < ILspHandlerDescriptor > > ( collection ) ;
70
+ var handlerMatcher = AutoSubstitute . Resolve < TextDocumentMatcher > ( ) ;
71
+
72
+ // When
73
+ var result = handlerMatcher . FindHandler (
74
+ new DidOpenTextDocumentParams {
75
+ TextDocument = new TextDocumentItem {
76
+ Uri = new Uri ( "file:///abc/123/d.cs" )
77
+ }
78
+ } ,
79
+ collection . Where ( x => x . Method == TextDocumentNames . DidOpen )
80
+ ) ;
81
+
82
+ // Then
83
+ var lspHandlerDescriptors = result as ILspHandlerDescriptor [ ] ?? result . ToArray ( ) ;
84
+ lspHandlerDescriptors . Should ( ) . NotBeNullOrEmpty ( ) ;
85
+ lspHandlerDescriptors . Should ( ) . Contain ( x => x . Method == TextDocumentNames . DidOpen ) ;
86
+ }
87
+
57
88
[ Fact ]
58
89
public void Should_Return_Did_Open_Text_Document_Handler_Descriptor ( )
59
90
{
0 commit comments