File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 22
33namespace LEGO . AsyncAPI . Tests
44{
5+ using System ;
6+ using System . Collections . Generic ;
57 using LEGO . AsyncAPI . Models ;
68 using LEGO . AsyncAPI . Models . Interfaces ;
7- using System ;
89
910 internal class AsyncApiDocumentBuilder
1011 {
@@ -42,6 +43,10 @@ public AsyncApiDocumentBuilder WithDefaultContentType(string contentType = "appl
4243
4344 public AsyncApiDocumentBuilder WithChannel ( string key , AsyncApiChannel channel )
4445 {
46+ if ( this . document . Channels == null )
47+ {
48+ this . document . Channels = new Dictionary < string , AsyncApiChannel > ( ) ;
49+ }
4550 this . document . Channels . Add ( key , channel ) ;
4651 return this ;
4752 }
Original file line number Diff line number Diff line change @@ -1202,6 +1202,10 @@ public void Serialize_WithBindingReferences_SerializesDeserializes()
12021202 } ,
12031203 } ,
12041204 } ;
1205+ if ( doc . Channels == null )
1206+ {
1207+ doc . Channels = new Dictionary < string , AsyncApiChannel > ( ) ;
1208+ }
12051209 doc . Channels . Add (
12061210 "testChannel" ,
12071211 new AsyncApiChannel
@@ -1260,6 +1264,10 @@ public void Serializev2_WithBindings_Serializes()
12601264 Protocol = "pulsar+ssl" ,
12611265 Url = "example.com" ,
12621266 } ) ;
1267+ if ( doc . Channels == null )
1268+ {
1269+ doc . Channels = new Dictionary < string , AsyncApiChannel > ( ) ;
1270+ }
12631271 doc . Channels . Add (
12641272 "testChannel" ,
12651273 new AsyncApiChannel
You can’t perform that action at this time.
0 commit comments