示例#1
0
        public void ListReferenced()
        {
            var value = new IntListClassReferenced(true);
            var w     = new Writer();
            var cs    = new ClassSerializer(typeof(IntListClassReferenced));

            Assert.True(cs.Write(w, value, null));
            Assert.AreEqual("!Test.IntListClassReferenced{List1:[11,42,65],List2:[11,42,65]}", w.ToString());

            var r      = new Reader(w.ToString());
            var result = cs.Read(r, null, null) as IntListClassReferenced;

            Assert.IsNotNull(result);
            Assert.IsFalse(r.AnyLeft, "Any characters left.");
            Assert.IsFalse(value.IsSame(result), "Read back value is not the same.");
        }
 public bool IsSame(IntListClassReferenced other)
 {
     return(ReferenceEquals(other.List2, other.List1) && base.IsSame(other));
 }