Skip to content

Commit 8817137

Browse files
committed
add additional testing for the metadata
1 parent 453db29 commit 8817137

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

test/LEGO.AsyncAPI.Tests/Models/AvroSchema_Should.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ public void Deserialize_WithMetadata_CreatesMetadata()
1919
"type": "record",
2020
"name": "SomeEvent",
2121
"namespace": "my.namspace.for.event",
22-
"example": {
23-
"occurredOn": "2023-11-03T09:59:56.582908743Z",
24-
"partnerId": "1",
25-
"platformSource": "Brecht",
26-
"countryCode": "DE"
27-
},
2822
"fields": [
2923
{
3024
"name": "countryCode",
@@ -46,11 +40,23 @@ public void Deserialize_WithMetadata_CreatesMetadata()
4640
"type": "string",
4741
"doc": "Platform source"
4842
}
49-
]
43+
],
44+
"example": {
45+
"occurredOn": "2023-11-03T09:56.582+00:00",
46+
"partnerId": "1",
47+
"platformSource": "Brecht",
48+
"countryCode": "DE"
49+
}
5050
}
5151
""";
5252
var model = new AsyncApiStringReader().ReadFragment<AvroSchema>(input, AsyncApiVersion.AsyncApi2_0, out var diag);
5353
model.Metadata.Should().HaveCount(1);
54+
var reserialized = model.SerializeAsJson(AsyncApiVersion.AsyncApi2_0);
55+
56+
// Assert
57+
input.Should()
58+
.BePlatformAgnosticEquivalentTo(reserialized);
59+
5460
}
5561

5662
[Test]

0 commit comments

Comments
 (0)