Example #1
0
        public void Merge_WithNestedObject_MergesNestedProperties()
        {
            // Arrange
            var @base = new NestingDemo
            {
                Comment = "base comment",
                Nested  = new Demo
                {
                    Age  = 20,
                    Name = "Tim"
                }
            };
            var @new = new NestingDemo
            {
                Comment = "new comment",
                Nested  = new Demo
                {
                    Age = 10
                }
            };
            var expected = new NestingDemo
            {
                Comment = "new comment",
                Nested  = new Demo
                {
                    Age  = 10,
                    Name = "Tim"
                }
            };

            // Act
            @base.MergeWith(@new);

            // Assert
            Assert.AreEqual(expected, @base);
        }
 public bool Equals(NestingDemo other)
 {
     return Comment == other.Comment && Equals(Nested, other.Nested);
 }
        public void Merge_WithNestedObject_MergesNestedProperties()
        {
            // Arrange
            var @base = new NestingDemo
            {
                Comment = "base comment",
                Nested = new Demo
                {
                    Age = 20,
                    Name = "Tim"
                }
            };
            var @new = new NestingDemo
            {
                Comment = "new comment",
                Nested = new Demo
                {
                    Age = 10
                }
            };
            var expected = new NestingDemo
            {
                Comment = "new comment",
                Nested = new Demo
                {
                    Age = 10,
                    Name = "Tim"
                }
            };

            // Act
            @base.MergeWith(@new);

            // Assert
            Assert.AreEqual(expected, @base);
        }
Example #4
0
 public bool Equals(NestingDemo other)
 {
     return(Comment == other.Comment && Equals(Nested, other.Nested));
 }