예제 #1
0
 public bool Equals(Demo obj)
 {
     if (obj == null)
     {
         return false;
     }
     return Name == obj.Name && Age == obj.Age;
 }
예제 #2
0
        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);
        }
예제 #3
0
 public NestingDemo()
 {
     Nested = new Demo();
 }
예제 #4
0
        public void Merge_WithEmptyIterable_ReturnsDefaultObject()
        {
            // Arrange
            var expected = new Demo();

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

            // Assert
            Assert.AreEqual(expected, actual);
        }
예제 #5
0
        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);
        }
예제 #6
0
 public NestingDemo()
 {
     Nested = new Demo();
 }