Пример #1
0
        public void TestJsonSerialize() {
            string result;
            using (var stream = new StringMemoryStream()) {
                Serializer.JsonSerialize(stream, Dummy);
                result = stream.ToDecodedString();
            }

            Assert.AreEqual(DummyJson, result);
        }
Пример #2
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);
        }