Exemplo n.º 1
0
        public static void Execute()
        {
            var xMyType = new MyType();

            xMyType.IntField       = 42;
            xMyType.ReferenceField = new object();

            var xCloneType = xMyType.Clone();

            Assert.AreEqual(xMyType.IntField, xCloneType.IntField, "Cloned object has a different IntField value!");
            Assert.IsTrue(object.ReferenceEquals(xMyType.ReferenceField, xCloneType.ReferenceField), "References of field aren't the same!");
            xCloneType.IntField = 56;
            Assert.AreEqual(xMyType.IntField, 42, "Cloned object is linked to original object!");
        }
Exemplo n.º 2
0
        public static void Execute()
        {
            var xMyType = new MyType();

            xMyType.IntField = 42;
            xMyType.ReferenceField = new object();

            var xCloneType = xMyType.Clone();
            
            Assert.AreEqual(xMyType.IntField, xCloneType.IntField, "Cloned object has a different IntField value!");
            Assert.IsTrue(ReferenceEquals(xMyType.ReferenceField, xCloneType.ReferenceField), "References of field aren't the same!");

            xCloneType.IntField = 56;

            Assert.AreEqual(xMyType.IntField, 42, "Cloned object is linked to original object!");
        }