Example #1
0
 protected void AssertSerializedRequest <TRequest>(
     TRequest request,
     string serialized
     ) where TRequest : Request
 {
     using (var ms = new StringMemoryStream())
     {
         Serializer.JsonSerialize(ms, request);
         Assert.AreEqual(serialized, ms.ToDecodedString());
     }
 }
Example #2
0
        public void TestJsonSerialize()
        {
            string result;

            using (var stream = new StringMemoryStream()) {
                Serializer.JsonSerialize(stream, Dummy);
                result = stream.ToDecodedString();
            }

            Assert.AreEqual(DummyJson, result);
        }
Example #3
0
        public void TestJsonDeserialize()
        {
            var json = DummyJson;

            SerializerTestDummy result;

            using (var stream = new StringMemoryStream(json)) {
                result = Serializer.JsonDeserialize <SerializerTestDummy>(stream);
            }

            Assert.IsNotNull(result);
            Assert.AreEqual(Dummy.James, result.James);
            Assert.AreEqual(Dummy.Scott, result.Scott);
        }