Skip to content

Commit c32d98a

Browse files
dermotblaircaRehanSaeed
authored andcommitted
Adding new test and adding to existing test
1 parent 995bc2d commit c32d98a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Tests/Schema.NET.Test/ValuesJsonConverterTest.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,14 @@ public void ReadJson_ParseValueToken_UriAsString()
263263
Assert.Equal(new Uri("https://schema.org/Thing"), result.Value2.First());
264264
}
265265

266+
[Fact]
267+
public void ReadJson_ParseValueToken_RelativeUriAsString()
268+
{
269+
var json = "{\"Property\":\"/Thing\"}";
270+
var result = DeserializeObject<Values<string, Uri>>(json);
271+
Assert.Equal(new Uri("/Thing", UriKind.Relative), result.Value2.First());
272+
}
273+
266274
[Fact]
267275
public void ReadJson_Values_SingleValue_ThingInterface()
268276
{
@@ -273,6 +281,7 @@ public void ReadJson_Values_SingleValue_ThingInterface()
273281
"\"@id\":\"https://example.com/book/1\"," +
274282
"\"name\":\"The Catcher in the Rye\"," +
275283
"\"url\":\"https://www.barnesandnoble.com/store/info/offer/JDSalinger\"," +
284+
"\"image\":\"/images/book/1\"," +
276285
"\"author\":{" +
277286
"\"@type\":\"Person\"," +
278287
"\"name\":\"J.D. Salinger\"" +
@@ -285,6 +294,7 @@ public void ReadJson_Values_SingleValue_ThingInterface()
285294
Assert.Equal(new Uri("https://example.com/book/1"), ((Book)actual).Id);
286295
Assert.Equal("The Catcher in the Rye", actual.Name);
287296
Assert.Equal(new Uri("https://www.barnesandnoble.com/store/info/offer/JDSalinger"), (Uri)actual.Url!);
297+
Assert.Equal(new Uri("/images/book/1", UriKind.Relative), (Uri)actual.Image!);
288298
var author = Assert.Single(actual.Author.Value2);
289299
Assert.Equal("J.D. Salinger", author.Name);
290300
}

0 commit comments

Comments
 (0)