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()); } }
public void TestJsonSerialize() { string result; using (var stream = new StringMemoryStream()) { Serializer.JsonSerialize(stream, Dummy); result = stream.ToDecodedString(); } Assert.AreEqual(DummyJson, result); }
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); }