예제 #1
0
        public void Merge_WithNestedObjectNullByDefault_MergesNestedProperties()
        {
            // Arrange
            var @base = new NestingDemoWithNullDefaultNestedSection
            {
                Nested = new Demo
                {
                    Age  = 20,
                    Name = "Tim"
                }
            };
            var @new = new NestingDemoWithNullDefaultNestedSection
            {
                Nested = new Demo
                {
                    Age = 10
                }
            };
            var expected = new NestingDemoWithNullDefaultNestedSection
            {
                Nested = new Demo
                {
                    Age  = 10,
                    Name = "Tim"
                }
            };

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

            // Assert
            Assert.AreEqual(expected, @base);
        }
예제 #2
0
        public void Merge_WithNestedObjectNullByDefault_MergesNestedProperties()
        {
            // Arrange
            var @base = new NestingDemoWithNullDefaultNestedSection
            {
                Nested = new Demo
                {
                    Age = 20,
                    Name = "Tim"
                }
            };
            var @new = new NestingDemoWithNullDefaultNestedSection
            {
                Nested = new Demo
                {
                    Age = 10
                }
            };
            var expected = new NestingDemoWithNullDefaultNestedSection
            {
                Nested = new Demo
                {
                    Age = 10,
                    Name = "Tim"
                }
            };

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

            // Assert
            Assert.AreEqual(expected, @base);
        }