Esempio n. 1
0
        public void TestDeepClone()
        {
            NonGenericBasic ngb = new NonGenericBasic { Value = 123 },
                clone = (NonGenericBasic) Serializer.NonGeneric.DeepClone(ngb);

            Assert.AreNotSame(ngb, clone);
            Assert.AreEqual(ngb.Value, clone.Value);
        }
Esempio n. 2
0
        public void TestDeepClone()
        {
            NonGenericBasic ngb = new NonGenericBasic {
                Value = 123
            },
                            clone = (NonGenericBasic)Serializer.NonGeneric.DeepClone(ngb);

            Assert.AreNotSame(ngb, clone);
            Assert.AreEqual(ngb.Value, clone.Value);
        }
Esempio n. 3
0
        public void TestDeepClone()
        {
#pragma warning disable CS0618
            NonGenericBasic ngb = new NonGenericBasic {
                Value = 123
            },
                            clone = (NonGenericBasic)Serializer.NonGeneric.DeepClone(ngb);
#pragma warning restore CS0618

            Assert.NotSame(ngb, clone);
            Assert.Equal(ngb.Value, clone.Value);
        }
Esempio n. 4
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. 5
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. 6
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);
        }