From 8817137cab3839a4c89229e7951c7d619e319bfd Mon Sep 17 00:00:00 2001 From: VisualBean Date: Mon, 3 Jun 2024 12:30:47 +0200 Subject: [PATCH] add additional testing for the metadata --- .../Models/AvroSchema_Should.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test/LEGO.AsyncAPI.Tests/Models/AvroSchema_Should.cs b/test/LEGO.AsyncAPI.Tests/Models/AvroSchema_Should.cs index 8be9f67e..2b5b5b0e 100644 --- a/test/LEGO.AsyncAPI.Tests/Models/AvroSchema_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Models/AvroSchema_Should.cs @@ -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", @@ -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(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]