13
13
using HandlerCollection = OmniSharp . Extensions . LanguageServer . HandlerCollection ;
14
14
using OmniSharp . Extensions . LanguageServer . Models ;
15
15
using OmniSharp . Extensions . LanguageServer . Abstractions ;
16
+ using OmniSharp . Extensions . LanguageServer . Handlers ;
16
17
17
18
namespace Lsp . Tests
18
19
{
@@ -21,19 +22,35 @@ public class HandlerResolverTests
21
22
[ Theory ]
22
23
[ InlineData ( typeof ( IInitializeHandler ) , "initialize" , 1 ) ]
23
24
[ InlineData ( typeof ( IInitializedHandler ) , "initialized" , 1 ) ]
25
+ [ InlineData ( typeof ( IShutdownHandler ) , "shutdown" , 1 ) ]
26
+ [ InlineData ( typeof ( IExitHandler ) , "exit" , 1 ) ]
24
27
public void Should_Contain_AllDefinedMethods ( Type requestHandler , string key , int count )
25
28
{
26
29
var handler = new HandlerCollection ( ) ;
27
30
var sub = ( IJsonRpcHandler ) Substitute . For ( new Type [ ] { requestHandler } , new object [ 0 ] ) ;
28
- if ( sub is IRegistration < TextDocumentRegistrationOptions > reg )
29
- reg . GetRegistrationOptions ( )
30
- . Returns ( new TextDocumentRegistrationOptions ( ) ) ;
31
31
32
32
handler . Add ( sub ) ;
33
33
handler . _handlers . Should ( ) . Contain ( x => x . Method == key ) ;
34
34
handler . _handlers . Count . Should ( ) . Be ( count ) ;
35
35
}
36
36
37
+ [ Fact ]
38
+ public void Should_Contain_AllConcreteDefinedMethods ( )
39
+ {
40
+ var handler = new HandlerCollection ( ) ;
41
+
42
+ handler . Add (
43
+ Substitute . For < IExitHandler > ( ) ,
44
+ Substitute . For < IInitializeHandler > ( ) ,
45
+ Substitute . For < IInitializedHandler > ( ) ,
46
+ Substitute . For < IShutdownHandler > ( )
47
+ ) ;
48
+
49
+ handler . _handlers . Should ( ) . Contain ( x => x . Method == "exit" ) ;
50
+ handler . _handlers . Should ( ) . Contain ( x => x . Method == "shutdown" ) ;
51
+ handler . _handlers . Count . Should ( ) . Be ( 4 ) ;
52
+ }
53
+
37
54
[ Theory ]
38
55
[ InlineData ( "textDocument/didOpen" , 4 ) ]
39
56
[ InlineData ( "textDocument/didChange" , 4 ) ]
@@ -151,22 +168,5 @@ public void Should_Contain_AllDefinedMethods_OnLanguageServer_WithDifferentKeys(
151
168
handler . _handlers . Should ( ) . Contain ( x => x . Method == key2 ) ;
152
169
handler . _handlers . Count . Should ( ) . Be ( count ) ;
153
170
}
154
-
155
- [ Fact ]
156
- public void Should_BeAwesome ( )
157
- {
158
- var handler = new HandlerCollection ( ) ;
159
-
160
- handler . Add (
161
- Substitute . For < IExitHandler > ( ) ,
162
- Substitute . For < IInitializeHandler > ( ) ,
163
- Substitute . For < IInitializedHandler > ( ) ,
164
- Substitute . For < IShutdownHandler > ( )
165
- ) ;
166
-
167
- handler . _handlers . Should ( ) . Contain ( x => x . Method == "exit" ) ;
168
- handler . _handlers . Should ( ) . Contain ( x => x . Method == "shutdown" ) ;
169
- handler . _handlers . Count . Should ( ) . Be ( 4 ) ;
170
- }
171
171
}
172
172
}
0 commit comments