public void Merge_WhenClassesAreSpecified_PropertiesMergedCorrectly()
        {
            // arrange
            var sourcePropertyIterator = new Mock<IInstanceMemberIterator<PropertyInfo, PropertySourceTest>>();
            sourcePropertyIterator.Setup(p => p.GetEnumerator()).Returns(this.CreateSourceEnumerator);
            var destinationPropertyIterator = new Mock<IInstanceMemberIterator<PropertyInfo, PropertyDestinationTest>>();
            destinationPropertyIterator.Setup(p => p.GetEnumerator()).Returns(this.CreateDestinationEnumerator);

            var iteratorFactory = new Mock<IIteratorFactory<PropertyInfo>>();
            iteratorFactory.Setup(p => p.CreateSourceIterator<PropertySourceTest>()).Returns(sourcePropertyIterator.Object);
            iteratorFactory.Setup(p => p.CreateDestinationIterator<PropertyDestinationTest>()).Returns(destinationPropertyIterator.Object);

            // act
            var mergeManager = new MemberMergeManager<PropertyInfo>(iteratorFactory.Object, _equalityComparerFactory);
            var mergeResult = mergeManager.Merge<PropertySourceTest, PropertyDestinationTest>().Select(p => p.MemberInfo).ToList();

            // assert
            Type type = typeof(PropertyDestinationTest);
            var expectedResult = new List<PropertyInfo>
            {
                type.GetProperty(Utils.GetPropertyName<PropertyDestinationTest, string>(p => p.PropString)),
                type.GetProperty(Utils.GetPropertyName<PropertyDestinationTest, int>(p => p.PropInt1)),
                type.GetProperty(Utils.GetPropertyName<PropertyDestinationTest, List<int>>(p => p.PropListInt))
            };

            Assert.Equal(expectedResult.OrderBy(p => p.Name), mergeResult.OrderBy(p => p.Name), _equalityComparerFactory.Create());
        }
        public void Merge_WhenClassesAreSpecified_FieldsMergedCorrectly()
        {
            // assign
            var sourceFieldIterator = new Mock<IInstanceMemberIterator<FieldInfo, FieldSourceTest>>();
            sourceFieldIterator.Setup(p => p.GetEnumerator()).Returns(this.CreateSourceEnumerator);
            var destinationFieldIterator = new Mock<IInstanceMemberIterator<FieldInfo, FieldDestinationTest>>();
            destinationFieldIterator.Setup(p => p.GetEnumerator()).Returns(this.CreateDestinationEnumerator);

            var iteratorFactory = new Mock<IIteratorFactory<FieldInfo>>();
            iteratorFactory.Setup(p => p.CreateSourceIterator<FieldSourceTest>()).Returns(sourceFieldIterator.Object);
            iteratorFactory.Setup(p => p.CreateDestinationIterator<FieldDestinationTest>()).Returns(destinationFieldIterator.Object);

            var mergeManager = new MemberMergeManager<FieldInfo>(iteratorFactory.Object, _equalityComparerFactory);
            var mergeResult = mergeManager.Merge<FieldSourceTest, FieldDestinationTest>().Select(p => p.MemberInfo).ToList();

            // assert
            var type = typeof (FieldDestinationTest);
            var expectedResult = new List<FieldInfo>
            {
                type.GetField(Utils.GetFieldName<FieldDestinationTest, string>(p => p.FieldString)),
                type.GetField(Utils.GetFieldName<FieldDestinationTest, int>(p => p.FieldInt2)),
                type.GetField(Utils.GetFieldName<FieldDestinationTest, List<string>>(p => p.FieldListString))
            };

            Assert.Equal(expectedResult.OrderBy(p => p.Name), mergeResult.OrderBy(p => p.Name), _equalityComparerFactory.Create());
        }
        public void Merge_WhenClassesHaveNoCommonProperties_TheResultIsMepy()
        {
            // arrange
            var sourcePropertyIterator = new Mock<IInstanceMemberIterator<PropertyInfo, PropertySourceTest>>();
            sourcePropertyIterator.Setup(p => p.GetEnumerator()).Returns(this.CreateSpecificSourceEnumerator);
            var destinationPropertyIterator = new Mock<IInstanceMemberIterator<PropertyInfo, PropertyDestinationTest>>();
            destinationPropertyIterator.Setup(p => p.GetEnumerator()).Returns(this.CreateSpecificDestinationEnumerator);

            var iteratorFactory = new Mock<IIteratorFactory<PropertyInfo>>();
            iteratorFactory.Setup(p => p.CreateSourceIterator<PropertySourceTest>()).Returns(sourcePropertyIterator.Object);
            iteratorFactory.Setup(p => p.CreateDestinationIterator<PropertyDestinationTest>()).Returns(destinationPropertyIterator.Object);

            // act
            var mergeManager = new MemberMergeManager<PropertyInfo>(iteratorFactory.Object, _equalityComparerFactory);
            var mergeResult = mergeManager.Merge<PropertySourceTest, PropertyDestinationTest>().Select(p => p.MemberInfo).ToList();

            // assert
            Assert.Equal(Enumerable.Empty<PropertyInfo>(), mergeResult);
        }