@@ -467,22 +467,36 @@ public async Task VerifyDiagramFromSampleOpenAPI()
467467            await  Verifier . Verify ( diagram ) ; 
468468        } 
469469
470-         [ Fact ] 
471-         public  void  SupportsTrailingSlashesInPath ( ) 
470+         public  static   TheoryData < string ,  string [ ] ,  string ,  string >  SupportsTrailingSlashesInPathData  =>  new  TheoryData < string ,  string [ ] ,  string ,  string > 
471+         { 
472+             // Path, children up to second to leaf, last expected leaf node name, expected leaf node path 
473+             {  "/cars/{car-id}/build/" ,  [ "cars" ,  "{car-id}" ] ,  "build/" ,  @"\cars\{car-id}\build/"  } , 
474+             {  "/cars/" ,  [ ] ,  "cars/" ,  @"\cars/"  } , 
475+         } ; 
476+ 
477+         [ Theory ] 
478+         [ MemberData ( nameof ( SupportsTrailingSlashesInPathData ) ) ] 
479+         public  void  SupportsTrailingSlashesInPath ( string  path ,  string [ ]  childrenBeforeLastNode ,  string  expectedLeafNodeName ,  string  expectedLeafNodePath ) 
472480        { 
473481            var  openApiDocument  =  new  OpenApiDocument 
474482            { 
475483                Paths  =  new ( ) 
476484                { 
477-                     [ "/cars/{car-id}/build/" ]  =  new ( ) 
485+                     [ path ]  =  new ( ) 
478486                } 
479487            } ; 
480488
481-             var  label1  =  "trailing-slash" ; 
482-             var  rootNode  =  OpenApiUrlTreeNode . Create ( openApiDocument ,  label1 ) ; 
483-             var  buildNode  =  rootNode . Children [ "cars" ] . Children [ "{car-id}" ] . Children [ "build" ] ; 
489+             var  label  =  "trailing-slash" ; 
490+             var  rootNode  =  OpenApiUrlTreeNode . Create ( openApiDocument ,  label ) ; 
491+ 
492+             var  secondToLeafNode  =  rootNode ; 
493+             foreach  ( var  childName  in  childrenBeforeLastNode ) 
494+             { 
495+                 secondToLeafNode  =  secondToLeafNode . Children [ childName ] ; 
496+             } 
484497
485-             // Should buildNode have a path of "build/" or should it have a child with an empty string key? 
498+             Assert . True ( secondToLeafNode . Children . TryGetValue ( expectedLeafNodeName ,  out  var  lastNode ) ) ; 
499+             Assert . Equal ( expectedLeafNodePath ,  lastNode . Path ) ; 
486500        } 
487501    } 
488502} 
0 commit comments