public async Task BoxedStructReferencePreservation_NestedStructCollection() { IBoxedStructWithObjectProperty value = new StructCollection(); value.Property = new object[] { value }; string json = await JsonSerializerWrapperForString.SerializeWrapper(value, s_serializerOptionsPreserve); Assert.Equal(@"{""$id"":""1"",""Property"":[{""$ref"":""1""}]}", json); }
public static void BoxedStructReferencePreservation_NestedStructCollection() { IBoxedStructWithObjectProperty value = new StructCollection(); value.Property = new object[] { value }; string json = JsonSerializer.Serialize(value, s_serializerOptionsPreserve); Assert.Equal(@"{""$id"":""1"",""Property"":[{""$ref"":""1""}]}", json); }
public async Task BoxedStructReferencePreservation_SiblingStructCollections() { object box = new StructCollection { Property = 42 }; var array = new object[] { box, box }; string json = await JsonSerializerWrapperForString.SerializeWrapper(array, s_serializerOptionsPreserve); Assert.Equal(@"[{""$id"":""1"",""$values"":[42]},{""$ref"":""1""}]", json); }
public static void BoxedStructReferencePreservation_SiblingStructCollections() { object box = new StructCollection { Property = 42 }; var array = new object[] { box, box }; string json = JsonSerializer.Serialize(array, s_serializerOptionsPreserve); Assert.Equal(@"[{""$id"":""1"",""$values"":[42]},{""$ref"":""1""}]", json); }