Skip to content

Commit fe10a52

Browse files
committed
fix: property lookup for unit test
Signed-off-by: Vincent Biret <[email protected]>
1 parent 1b1586e commit fe10a52

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public void CreatesCollectionResponseSchema(bool enablePagination, bool enableCo
7272
Assert.Equal(JsonSchemaType.Array, item.Properties["value"].Type);
7373
});
7474

75-
Assert.Equal(JsonSchemaType.Array, flightCollectionResponse.AllOf?.FirstOrDefault(x => x.Properties.Any())?.Properties["value"].Type);
76-
Assert.Equal("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Flight",
77-
flightCollectionResponse.AllOf?.FirstOrDefault(x => x.Properties.Any())?.Properties["value"].Items.Reference.Id);
75+
Assert.Single(flightCollectionResponse.AllOf?.Where(x => x.Properties.TryGetValue("value", out var valueProp) &&
76+
(valueProp.Type & JsonSchemaType.Array) is JsonSchemaType.Array &&
77+
"Microsoft.OData.Service.Sample.TrippinInMemory.Models.Flight".Equals(valueProp.Items.Reference.Id)));
7878
}
7979
else
8080
{

0 commit comments

Comments
 (0)