Esempio n. 1
0
 public void TestManualCloneViaSerializeDeserialize()
 {
     NonGenericBasic ngb = new NonGenericBasic { Value = 123 }, clone;
     using (MemoryStream ms = new MemoryStream())
     {
         Serializer.NonGeneric.Serialize(ms, ngb);
         ms.Position = 0;
         clone = (NonGenericBasic)Serializer.NonGeneric.Deserialize(
             ngb.GetType(), ms);
     }
     Assert.AreNotSame(ngb, clone);
     Assert.AreEqual(ngb.Value, clone.Value);
 }
Esempio n. 2
0
        public void TestManualCloneViaSerializeDeserialize()
        {
            NonGenericBasic ngb = new NonGenericBasic {
                Value = 123
            }, clone;

            using (MemoryStream ms = new MemoryStream())
            {
                Serializer.NonGeneric.Serialize(ms, ngb);
                ms.Position = 0;
                clone       = (NonGenericBasic)Serializer.NonGeneric.Deserialize(
                    ngb.GetType(), ms);
            }
            Assert.AreNotSame(ngb, clone);
            Assert.AreEqual(ngb.Value, clone.Value);
        }
Esempio n. 3
0
        public void TestManualCloneViaSerializeDeserialize()
        {
            NonGenericBasic ngb = new NonGenericBasic {
                Value = 123
            }, clone;

            using (MemoryStream ms = new MemoryStream())
            {
#pragma warning disable CS0618
                Serializer.NonGeneric.Serialize(ms, ngb);
                ms.Position = 0;
                clone       = (NonGenericBasic)Serializer.NonGeneric.Deserialize(
                    ngb.GetType(), ms);
#pragma warning restore CS0618
            }
            Assert.NotSame(ngb, clone);
            Assert.Equal(ngb.Value, clone.Value);
        }