Exemple #1
0
 public override IComparerResult Compare()
 {
     ComparerContext.LogDetail(string.Format("Comparing parameter '{0}'", ReferenceType.ParameterType));
     CompareAttributes();
     CompareName();
     CompareDefaultValue();
     return(ComparerResult);
 }
Exemple #2
0
 public override IComparerResult Compare()
 {
     ComparerContext.LogDetail(string.Format("Comparing method '{0}'", ReferenceType));
     CompareAttributes();
     CompareReturnType();
     CompareParameters();
     return(ComparerResult);
 }
Exemple #3
0
 public override IComparerResult Compare()
 {
     ComparerContext.LogDetail(string.Format("Comparing {0} '{1}'", GetItemType(ReferenceType), ReferenceType.GetCompareableName()));
     CompareAttributes();
     CompareInterfaces();
     CompareBase();
     CompareMethods(type => type.GetApiMethods().Where(method => ComparerContext.IsNotIgnored(method)).Cast <MethodBase>().ToArray(), (type, name, types) => type.GetMethod(name, types), ResultContext.Method);
     CompareMethods(type => type.GetApiConstructors().Where(ctor => ComparerContext.IsNotIgnored(ctor)).Cast <MethodBase>().ToArray(), (type, name, types) => type.GetApiConstructor(name, types), ResultContext.Constructor);
     CompareProperties();
     CompareEvents();
     CompareFields();
     return(ComparerResult);
 }
Exemple #4
0
        public override IComparerResult Compare()
        {
            ComparerContext.LogDetail(string.Format("Comparing event '{0}'", ReferenceType));
            if (ReferenceType.EventHandlerType.GetCompareableName() != NewType.EventHandlerType.GetCompareableName())
            {
                ComparerResult.AddChangedProperty("Type", ReferenceType.EventHandlerType.GetCompareableName(), NewType.EventHandlerType.GetCompareableName(), Severity.Error);
            }
            bool referenceStatic = (ReferenceType.AddMethod != null && ReferenceType.AddMethod.IsStatic) || (ReferenceType.RaiseMethod != null && ReferenceType.RaiseMethod.IsStatic);
            bool newStatic       = (NewType.AddMethod != null && NewType.AddMethod.IsStatic) || (NewType.RaiseMethod != null && NewType.RaiseMethod.IsStatic);

            if (referenceStatic != newStatic)
            {
                ComparerResult.AddChangedFlag("Static", referenceStatic, Severity.Error);
            }
            return(ComparerResult);
        }
Exemple #5
0
 public override IComparerResult Compare()
 {
     ComparerContext.LogDetail(string.Format("Comparing field '{0}'", ReferenceType));
     if (ReferenceType.FieldType.GetCompareableName() != NewType.FieldType.GetCompareableName())
     {
         ComparerResult.AddChangedProperty("Type", ReferenceType.FieldType.GetCompareableName(), NewType.FieldType.GetCompareableName(), Severity.Error);
     }
     if (ReferenceType.IsStatic != NewType.IsStatic)
     {
         ComparerResult.AddChangedFlag("Static", ReferenceType.IsStatic, Severity.Error);
     }
     if (ReferenceType.IsStatic && NewType.IsStatic && ReferenceType.FieldType.IsEnum)
     {
         // compare numeric enum values
         object referenceValue = ReferenceType.GetRawConstantValue();
         object newValue       = NewType.GetRawConstantValue();
         if (Convert.ToInt32(referenceValue) != Convert.ToInt32(newValue))
         {
             ComparerResult.AddChangedProperty("Value", referenceValue.ToString(), newValue.ToString(), Severity.Error);
         }
     }
     return(ComparerResult);
 }
        public override IComparerResult Compare()
        {
            ComparerContext.LogDetail(string.Format("Comparing property '{0}'", ReferenceType));
            if (ReferenceType.PropertyType.GetCompareableName() != NewType.PropertyType.GetCompareableName())
            {
                ComparerResult.AddChangedProperty("Type", ReferenceType.PropertyType.GetCompareableName(), NewType.PropertyType.GetCompareableName(), Severity.Error);
            }
            if (ReferenceType.CanWrite != NewType.CanWrite)
            {
                ComparerResult.AddChangedFlag("Setter", ReferenceType.CanWrite, Severity.Error);
            }
            if (ReferenceType.CanRead != NewType.CanRead)
            {
                ComparerResult.AddChangedFlag("Getter", ReferenceType.CanRead, Severity.Error);
            }
            bool referenceStatic = (ReferenceType.GetMethod != null && ReferenceType.GetMethod.IsStatic) || (ReferenceType.SetMethod != null && ReferenceType.SetMethod.IsStatic);
            bool newStatic       = (NewType.GetMethod != null && NewType.GetMethod.IsStatic) || (NewType.SetMethod != null && NewType.SetMethod.IsStatic);

            if (referenceStatic != newStatic)
            {
                ComparerResult.AddChangedFlag("Static", referenceStatic, Severity.Error);
            }
            return(ComparerResult);
        }
 public override IComparerResult Compare()
 {
     ComparerContext.LogDetail(string.Format("Comparing constructor '{0}'", ReferenceType));
     CompareParameters();
     return(ComparerResult);
 }