public void SerializeUntypedToStream()
        {
            var serializer = new RestClientSerializer();
            var stream     = new MemoryStream();

            JToken json;
            var    expectedJson = JToken.Parse("{\"field\":\"Hello\"}");

            using (var streamWriter = new StreamWriter(stream))
            {
                var obj = new SingleValueTestData()
                {
                    Field = "Hello",
                };

                serializer.Serialize(streamWriter, obj);

                streamWriter.Flush();
                stream.Position = 0;

                using (var reader = new StreamReader(stream, Encoding.UTF8))
                {
                    var result = reader.ReadToEnd();
                    json = JToken.Parse(result);
                }
            }

            json.Should().BeEquivalentTo(expectedJson);
        }
        public void DeserializeFromStream()
        {
            var serializer = new RestClientSerializer();

            var json   = "{\"field\":\"Hello\"}";
            var stream = new MemoryStream(Encoding.UTF8.GetBytes(json));

            SingleValueTestData result;

            using (var streamReader = new StreamReader(stream))
            {
                result = serializer.Deserialize <SingleValueTestData>(streamReader);
            }

            var expected = new SingleValueTestData()
            {
                Field = "Hello"
            };

            result.Should().BeEquivalentTo(expected);
        }