Exemple #1
0
        public void Test3()
        {
            // Arrange
            var node1 = new Node {
                Value = 3
            };
            var node2 = new Node {
                Value = 3
            };
            var node3 = new Node {
                Value = 3
            };

            node1.Next = node2;
            node2.Next = node3;
            node3.Next = null;

            node1.Random = null;
            node2.Random = node1;
            node3.Random = null;

            // Act
            var deepCopy = DeepCopyHelper.DeepCopy(node1);

            // Assert
            IsDeepCopy(node1, deepCopy);
        }
Exemple #2
0
        public void Test1()
        {
            // Arrange
            var node1 = new Node {
                Value = 7
            };
            var node2 = new Node {
                Value = 13
            };
            var node3 = new Node {
                Value = 11
            };
            var node4 = new Node {
                Value = 10
            };
            var node5 = new Node {
                Value = 1
            };

            node1.Next = node2;
            node2.Next = node3;
            node3.Next = node4;
            node4.Next = node5;

            node1.Random = null;
            node2.Random = node1;
            node3.Random = node5;
            node4.Random = node3;
            node5.Random = node1;

            // Act
            var deepCopy = DeepCopyHelper.DeepCopy(node1);

            // Assert
            IsDeepCopy(node1, deepCopy);
        }