public async Task ReadParentChildRelationship() { Mocks.StringPipe stringPipe = new Mocks.StringPipe(); stringPipe.BufferInputString("{ \"parentprop\": \"parent\", \"child\": { \"stringprop\": \"test\", \"booleanprop\": true, \"numberprop\": 456 } }"); JsonBlockPipe reader = new JsonBlockPipe(stringPipe); ParentChildObject result = await reader.ReadBlockAsync <ParentChildObject>(); Assert.Equal("parent", result.ParentProp); Assert.Equal("test", result.Child.StringProp); Assert.True(result.Child.BooleanProp); Assert.Equal((long)456, result.Child.NumberProp); }
public async Task ReadParentChildRelationship() { Mocks.StringPipe stringPipe = new Mocks.StringPipe(); Mocks.StringPipe outputPipe = new Mocks.StringPipe(); ParentChildObject data = new ParentChildObject(); data.ParentProp = "parent"; data.Child = new SimpleObject() { StringProp = "test", BooleanProp = true, NumberProp = 456 }; stringPipe.BufferJsonRpcBlock(data); JsonRpcPipe reader = new JsonRpcPipe(stringPipe, outputPipe); ParentChildObject result = await reader.ReadBlock <ParentChildObject>(); Assert.Equal(data.ParentProp, result.ParentProp); Assert.NotNull(data.Child); Assert.Equal(data.Child.StringProp, result.Child.StringProp); Assert.Equal(data.Child.BooleanProp, result.Child.BooleanProp); Assert.Equal(data.Child.NumberProp, result.Child.NumberProp); }