public void SerializeNull() { var obj = new TestTopLevelObject { NestedId = null, Nested = null, }; var expected = "{\n \"nested\": null\n}"; Assert.Equal(expected, obj.ToJson().Replace("\r\n", "\n")); }
public void SerializeNotExpanded() { var obj = new TestTopLevelObject { NestedId = "id_not_expanded", Nested = null, }; var expected = "{\n \"nested\": \"id_not_expanded\"\n}"; Assert.Equal(expected, obj.ToJson().Replace("\r\n", "\n")); }
public void SerializeNull() { var obj = new TestTopLevelObject { InternalNested = new ExpandableField <TestNestedObject> { Id = null, ExpandedObject = null, }, }; var expected = "{\n \"nested\": null\n}"; Assert.Equal(expected, obj.ToJson().Replace("\r\n", "\n")); }
public void SerializeExpanded() { var nested = new TestNestedObject { Id = "id_expanded", Bar = 42, }; var obj = new TestTopLevelObject { NestedId = nested.Id, Nested = nested, }; var expected = "{\n \"nested\": {\n \"id\": \"id_expanded\",\n \"bar\": 42\n }\n}"; Assert.Equal(expected, obj.ToJson().Replace("\r\n", "\n")); }