|
5 | 5 |
|
6 | 6 | using System; |
7 | 7 | using System.Linq; |
| 8 | +using System.Text.Json.Nodes; |
8 | 9 | using Microsoft.OData.Edm; |
9 | 10 | using Microsoft.OpenApi.Extensions; |
10 | 11 | using Microsoft.OpenApi.Models; |
@@ -832,7 +833,7 @@ public void CreateEnumTypeSchemaReturnCorrectSchema() |
832 | 833 |
|
833 | 834 | Assert.NotNull(schema.Enum); |
834 | 835 | Assert.Equal(2, schema.Enum.Count); |
835 | | - Assert.Equal([ "Blue", "White" ], schema.Enum.Select(e => e)); |
| 836 | + Assert.Equal([ "Blue", "White" ], schema.Enum.Select(e => e.ToString())); |
836 | 837 |
|
837 | 838 | // Act |
838 | 839 | string json = schema.SerializeAsJson(OpenApiSpecVersion.OpenApi3_0); |
@@ -950,28 +951,28 @@ public void CreatePropertySchemaWithComputedAnnotationReturnsCorrectSchema(OpenA |
950 | 951 | // Act |
951 | 952 | var schema = context.CreatePropertySchema(property, new()); |
952 | 953 | Assert.NotNull(schema); |
953 | | - string json = schema.SerializeAsJson(specVersion); |
| 954 | + var json = JsonNode.Parse(schema.SerializeAsJson(specVersion)); |
954 | 955 |
|
955 | 956 | // Assert |
956 | 957 | if (specVersion == OpenApiSpecVersion.OpenApi2_0) |
957 | 958 | { |
958 | | - Assert.Equal(@"{ |
| 959 | + Assert.True(JsonNode.DeepEquals(JsonNode.Parse(@"{ |
959 | 960 | ""format"": ""duration"", |
960 | 961 | ""description"": ""The length of the appointment, denoted in ISO8601 format."", |
961 | 962 | ""pattern"": ""^-?P([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+([.][0-9]+)?S)?)?$"", |
962 | 963 | ""type"": ""string"", |
963 | 964 | ""readOnly"": true |
964 | | -}".ChangeLineBreaks(), json); |
| 965 | +}"), json)); |
965 | 966 | } |
966 | 967 | else |
967 | 968 | { |
968 | | - Assert.Equal(@"{ |
| 969 | + Assert.True(JsonNode.DeepEquals(JsonNode.Parse(@"{ |
969 | 970 | ""pattern"": ""^-?P([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+([.][0-9]+)?S)?)?$"", |
970 | 971 | ""type"": ""string"", |
971 | 972 | ""description"": ""The length of the appointment, denoted in ISO8601 format."", |
972 | 973 | ""format"": ""duration"", |
973 | 974 | ""readOnly"": true |
974 | | -}".ChangeLineBreaks(), json); |
| 975 | +}"), json)); |
975 | 976 | } |
976 | 977 | } |
977 | 978 | #endregion |
|
0 commit comments