Exemplo n.º 1
0
        private void CompareFields()
        {
            IEnumerable <string> referenceFields = GetFields(ReferenceType).ToList();
            IEnumerable <string> newFields       = GetFields(NewType).ToList();

            // missing fields
            foreach (string field in referenceFields.Except(newFields))
            {
                ComparerResult.AddRemovedItem(ResultContext.Field, field, Severity.Error);
            }

            // new fields
            foreach (string field in newFields.Except(referenceFields))
            {
                ComparerResult.AddAddedItem(ResultContext.Field, field, Severity.Warning);
            }

            // equal fields
            foreach (string field in referenceFields.Intersect(newFields))
            {
                ComparerResult.AddComparerResult(ComparerContext.CreateComparer(ReferenceType.GetField(field), NewType.GetField(field)).Compare());
            }
        }