Esempio n. 1
0
        private void CompareProperties()
        {
            PairList <Item> pairList = new PairList <Item>();

            GetProperties(ReferenceType).ForEach(property => pairList.AddReferenceItem(new Item(property.Name, property.GetIndexParameterTypes())));
            GetProperties(NewType).ForEach(property => pairList.AddNewItem(new Item(property.Name, property.GetIndexParameterTypes())));

            foreach (Item property in pairList.RemovedItems)
            {
                ComparerResult.AddRemovedItem(ResultContext.Property, ReferenceType.GetApiProperty(property.Name, property.Types).ToString(), Severity.Error);
            }

            foreach (Item property in pairList.AddedItems)
            {
                ComparerResult.AddAddedItem(ResultContext.Property, NewType.GetApiProperty(property.Name, property.Types).ToString(), Severity.Warning);
            }

            foreach (ItemPair <Item> property in pairList.EqualItems)
            {
                PropertyInfo referenceProperty = ReferenceType.GetApiProperty(property.ReferenceItem.Name, property.ReferenceItem.Types);
                PropertyInfo newProperty       = NewType.GetApiProperty(property.NewItem.Name, property.NewItem.Types);
                ComparerResult.AddComparerResult(ComparerContext.CreateComparer(referenceProperty, newProperty).Compare());
            }
        }