public JsonDeserializationTest() { var serializer = new JsonBodySerializer(); var json = $@"{{ StringValue : '{stringValue}', TestEnum : '{TestEnum.Bar}', NullableIntValue : {nullableIntValue}, DateTimeValue : '2011-12-23T13:37:00', TestMessageData : {{ IntValue : {intValue} }} }}"; var stream = new MemoryStream(); var writer = new StreamWriter(stream); writer.Write(json); writer.Flush(); stream.Position = 0; message = serializer.Deserialize(stream, typeof(TestMessage)) as TestMessage; }