Skip to content

Commit

Permalink
add additional testing for the metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualBean committed Jun 3, 2024
1 parent 453db29 commit 8817137
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions test/LEGO.AsyncAPI.Tests/Models/AvroSchema_Should.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ public void Deserialize_WithMetadata_CreatesMetadata()
"type": "record",
"name": "SomeEvent",
"namespace": "my.namspace.for.event",
"example": {
"occurredOn": "2023-11-03T09:59:56.582908743Z",
"partnerId": "1",
"platformSource": "Brecht",
"countryCode": "DE"
},
"fields": [
{
"name": "countryCode",
Expand All @@ -46,11 +40,23 @@ public void Deserialize_WithMetadata_CreatesMetadata()
"type": "string",
"doc": "Platform source"
}
]
],
"example": {
"occurredOn": "2023-11-03T09:56.582+00:00",
"partnerId": "1",
"platformSource": "Brecht",
"countryCode": "DE"
}
}
""";
var model = new AsyncApiStringReader().ReadFragment<AvroSchema>(input, AsyncApiVersion.AsyncApi2_0, out var diag);
model.Metadata.Should().HaveCount(1);
var reserialized = model.SerializeAsJson(AsyncApiVersion.AsyncApi2_0);

// Assert
input.Should()
.BePlatformAgnosticEquivalentTo(reserialized);

}

[Test]
Expand Down

0 comments on commit 8817137

Please sign in to comment.