55using GenHTTP . Modules . Layouting ;
66using GenHTTP . Modules . OpenApi ;
77using GenHTTP . Modules . OpenApi . Discovery ;
8- using Microsoft . OpenApi . Models ;
8+
99using Microsoft . VisualStudio . TestTools . UnitTesting ;
1010
1111using OpenApiDocument = NSwag . OpenApiDocument ;
@@ -26,10 +26,10 @@ public async Task TestTraversal(TestEngine engine)
2626 . AddRangeSupport ( )
2727 . Add ( ApiDescription . Create ( ) ) ;
2828
29- var doc = ( await api . GetOpenApiAsync ( engine ) ) . OpenApiDocument ;
29+ var doc = ( await api . GetOpenApiAsync ( engine ) ) . Document ;
3030
31- Assert . IsTrue ( doc . Paths . ContainsKey ( "/service/method" ) ) ;
32- Assert . IsTrue ( doc . Paths . ContainsKey ( "/method2" ) ) ;
31+ Assert . IsTrue ( doc ? . Paths . ContainsKey ( "/service/method" ) ?? false ) ;
32+ Assert . IsTrue ( doc ? . Paths . ContainsKey ( "/method2" ) ?? false ) ;
3333 }
3434
3535 [ TestMethod ]
@@ -40,9 +40,9 @@ public async Task TestCustomExplorer(TestEngine engine)
4040
4141 var api = Inline . Create ( ) . Add ( ApiDescription . With ( discovery ) ) ;
4242
43- var doc = ( await api . GetOpenApiAsync ( engine , false ) ) . OpenApiDocument ;
43+ var doc = ( await api . GetOpenApiAsync ( engine , false ) ) . Document ;
4444
45- Assert . AreEqual ( "Added by explorer" , doc . Servers . First ( ) . Description ) ;
45+ Assert . AreEqual ( "Added by explorer" , doc ? . Servers ? . First ( ) . Description ) ;
4646 }
4747
4848 [ TestMethod ]
@@ -54,16 +54,16 @@ public async Task TestSamePathWithDifferentMethods(TestEngine engine)
5454 . Put ( "/method" , ( int i ) => i )
5555 . Add ( ApiDescription . Create ( ) ) ;
5656
57- var doc = ( await api . GetOpenApiAsync ( engine ) ) . OpenApiDocument ;
57+ var doc = ( await api . GetOpenApiAsync ( engine ) ) . Document ! ;
5858
59- Assert . AreEqual ( 1 , doc . Paths . Count ) ;
59+ Assert . AreEqual ( 1 , doc . Paths ? . Count ?? 0 ) ;
6060
61- var operations = doc . Paths . First ( ) . Value . Operations ;
61+ var operations = doc . Paths ? . First ( ) . Value . Operations ;
6262
63- Assert . AreEqual ( 2 , operations . Count ) ;
63+ Assert . AreEqual ( 2 , operations ? . Count ?? 0 ) ;
6464
65- Assert . IsTrue ( operations . ContainsKey ( OperationType . Get ) ) ;
66- Assert . IsTrue ( operations . ContainsKey ( OperationType . Put ) ) ;
65+ Assert . IsTrue ( operations ? . ContainsKey ( HttpMethod . Get ) ) ;
66+ Assert . IsTrue ( operations ? . ContainsKey ( HttpMethod . Put ) ) ;
6767 }
6868
6969 #region Supporting data structures
0 commit comments