Ejemplo n.º 1
0
        public void MemberwiseCloneTest_ShouldReturnShallowCopy()
        {
            // Arrange
            var a = new MemberwiseCloneMock();
            a.ValueMember = 1;
            a.ObjectMember = new object();

            // Act
            var b = (MemberwiseCloneMock)a.MemberwiseClone();

            // Assert
            Assert.AreNotSame(a, b);
            Assert.AreEqual(a.ValueMember, b.ValueMember);
            Assert.AreSame(a.ObjectMember, b.ObjectMember);
        }
Ejemplo n.º 2
0
        public void MemberwiseCloneTest_ShouldReturnShallowCopy()
        {
            // Arrange
            var a = new MemberwiseCloneMock();

            a.ValueMember  = 1;
            a.ObjectMember = new object();

            // Act
            var b = (MemberwiseCloneMock)a.MemberwiseClone();

            // Assert
            Assert.AreNotSame(a, b);
            Assert.AreEqual(a.ValueMember, b.ValueMember);
            Assert.AreSame(a.ObjectMember, b.ObjectMember);
        }