public bool Equals(Demo obj)
 {
     if (obj == null)
     {
         return false;
     }
     return Name == obj.Name && Age == obj.Age;
 }
        public void MergeWith_WithCustomName_MergesNameIntoBase()
        {
            var @base = new Demo
                {
                    Age = 20,
                    Name = "Tim"
                };
            var @new = new Demo
                {
                    Name = "Fred"
                };
            var expected = new Demo
                {
                    Age = 20,
                    Name = "Fred"
                };

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

            // Assert
            Assert.AreEqual(expected, @base);
        }
 public NestingDemo()
 {
     Nested = new Demo();
 }
        public void Merge_WithEmptyIterable_ReturnsDefaultObject()
        {
            // Arrange
            var expected = new Demo();

            // Act
            var actual = new List<Demo>().Merge();

            // Assert
            Assert.AreEqual(expected, actual);
        }
        public void Merge_WithDefaultValueInConstructor_IgnoresDefaultValueWhenMerging()
        {
            var @base = new Demo
            {
                Age = 20,
                Name = "Tim"
            };
            var @new = new Demo
            {
                Age = 10
            };
            var expected = new Demo
            {
                Age = 10,
                Name = "Tim"
            };

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

            // Assert
            Assert.AreEqual(expected, @base);
        }
Exemple #6
0
 public NestingDemo()
 {
     Nested = new Demo();
 }