public void TestBasicDuplicatedString() { BasicDuplicatedString foo = new BasicDuplicatedString(), clone; foo.A = new string('a', 40); foo.B = new string('a', 40); Assert.AreNotSame(foo.A, foo.B); // different string refs using (var ms = new MemoryStream()) { Serializer.Serialize(ms, foo); Assert.AreEqual(50, ms.Length); ms.Position = 0; clone = Serializer.Deserialize<BasicDuplicatedString>(ms); } Assert.AreEqual(foo.A, clone.A); Assert.AreEqual(foo.B, clone.B); Assert.AreSame(clone.A, clone.B); }
public void TestBasicDuplicatedString() { BasicDuplicatedString foo = new BasicDuplicatedString(), clone; foo.A = new string('a', 40); foo.B = new string('a', 40); Assert.NotSame(foo.A, foo.B); // different string refs using (var ms = new MemoryStream()) { Serializer.Serialize(ms, foo); Assert.Equal(50, ms.Length); ms.Position = 0; clone = Serializer.Deserialize <BasicDuplicatedString>(ms); } Assert.Equal(foo.A, clone.A); Assert.Equal(foo.B, clone.B); Assert.Same(clone.A, clone.B); }
public void TestBasicDuplicatedString() { BasicDuplicatedString foo = new BasicDuplicatedString(), clone; foo.A = new string('a', 40); foo.B = new string('a', 40); Assert.AreNotSame(foo.A, foo.B); // different string refs using (var ms = new MemoryStream()) { var tm = TypeModel.Create(); tm.Serialize(ms, foo); //Assert.AreEqual(50, ms.Length); ms.Position = 0; clone = tm.Deserialize <BasicDuplicatedString>(ms); } Assert.AreEqual(foo.A, clone.A); Assert.AreEqual(foo.B, clone.B); Assert.AreSame(clone.A, clone.B); }