Skip to content

Commit f11240a

Browse files
committed
Added long awaited test
1 parent 26bf9dd commit f11240a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/LEGO.AsyncAPI.Tests/AsyncApiDocumentV2Tests.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,5 +1325,37 @@ public void Serializev2_WithBindings_Serializes()
13251325

13261326
Assert.AreEqual("this mah binding", httpBinding.Headers.Description);
13271327
}
1328+
1329+
1330+
1331+
[Test]
1332+
public void SerializeV2_EmptyChannelObject_DeserializeAndSerializePreserveChannelObject()
1333+
{
1334+
// Arrange
1335+
var spec = """
1336+
asyncapi: 2.6.0
1337+
info:
1338+
title: Spec with missing channel info
1339+
description: test description
1340+
servers:
1341+
production:
1342+
url: example.com
1343+
protocol: pulsar+ssl
1344+
description: test description
1345+
channels: { }
1346+
""";
1347+
1348+
var settings = new AsyncApiReaderSettings();
1349+
settings.Bindings = BindingsCollection.All;
1350+
var reader = new AsyncApiStringReader(settings);
1351+
1352+
// Act
1353+
var deserialized = reader.Read(spec, out var diagnostic);
1354+
var actual = deserialized.Serialize(AsyncApiVersion.AsyncApi2_0, AsyncApiFormat.Yaml);
1355+
1356+
// Assert
1357+
actual.Should()
1358+
.BePlatformAgnosticEquivalentTo(spec);
1359+
}
13281360
}
13291361
}

0 commit comments

Comments
 (0)