1313using HandlerCollection = OmniSharp . Extensions . LanguageServer . HandlerCollection ;
1414using OmniSharp . Extensions . LanguageServer . Models ;
1515using OmniSharp . Extensions . LanguageServer . Abstractions ;
16+ using OmniSharp . Extensions . LanguageServer . Handlers ;
1617
1718namespace Lsp . Tests
1819{
@@ -21,19 +22,35 @@ public class HandlerResolverTests
2122 [ Theory ]
2223 [ InlineData ( typeof ( IInitializeHandler ) , "initialize" , 1 ) ]
2324 [ InlineData ( typeof ( IInitializedHandler ) , "initialized" , 1 ) ]
25+ [ InlineData ( typeof ( IShutdownHandler ) , "shutdown" , 1 ) ]
26+ [ InlineData ( typeof ( IExitHandler ) , "exit" , 1 ) ]
2427 public void Should_Contain_AllDefinedMethods ( Type requestHandler , string key , int count )
2528 {
2629 var handler = new HandlerCollection ( ) ;
2730 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 ( ) ) ;
3131
3232 handler . Add ( sub ) ;
3333 handler . _handlers . Should ( ) . Contain ( x => x . Method == key ) ;
3434 handler . _handlers . Count . Should ( ) . Be ( count ) ;
3535 }
3636
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+
3754 [ Theory ]
3855 [ InlineData ( "textDocument/didOpen" , 4 ) ]
3956 [ InlineData ( "textDocument/didChange" , 4 ) ]
@@ -151,22 +168,5 @@ public void Should_Contain_AllDefinedMethods_OnLanguageServer_WithDifferentKeys(
151168 handler . _handlers . Should ( ) . Contain ( x => x . Method == key2 ) ;
152169 handler . _handlers . Count . Should ( ) . Be ( count ) ;
153170 }
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- }
171171 }
172172}
0 commit comments