Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.AdapterHelper.AreTwoAddressBookPropValueListEqual C# (CSharp) Method

AreTwoAddressBookPropValueListEqual() public static method

Compare whether two AddressBookPropValueLists are equal.
public static AreTwoAddressBookPropValueListEqual ( AddressBookPropertyValueList addressBookPropValueList1, AddressBookPropertyValueList addressBookPropValueList2 ) : bool
addressBookPropValueList1 AddressBookPropertyValueList The first AddressBookPropertyValueList used to compare.
addressBookPropValueList2 AddressBookPropertyValueList The second AddressBookPropertyValueList used to compare.
return bool
        public static bool AreTwoAddressBookPropValueListEqual(AddressBookPropertyValueList addressBookPropValueList1, AddressBookPropertyValueList addressBookPropValueList2)
        {
            if (addressBookPropValueList1.PropertyValueCount != addressBookPropValueList2.PropertyValueCount)
            {
                site.Log.Add(
                    LogEntryKind.Debug,
                    "The length the two AddressBookPropertyValueList are not equal. The length of addressBookPropValueList1 is {0}, the length of addressBookPropValueList2 is {1}.",
                    addressBookPropValueList1.PropertyValueCount,
                    addressBookPropValueList2.PropertyValueCount);

                return false;
            }
            else
            {
                AddressBookTaggedPropertyValue[] propertyValues1 = addressBookPropValueList1.PropertyValues;
                AddressBookTaggedPropertyValue[] propertyValues2 = addressBookPropValueList2.PropertyValues;
                
                for (int i = 0; i < propertyValues1.Length; i++)
                { 
                    if (propertyValues1[i].PropertyId != propertyValues2[i].PropertyId)
                    {
                        site.Log.Add(
                            LogEntryKind.Debug,
                            "The property ID of property {0} in the two property tag array are not equal. The property ID of propertyTag1 is {1}, the property ID of propertyTag2 is {2}",
                            i,
                            propertyValues1[i].PropertyId,
                            propertyValues2[i].PropertyId);

                        return false;
                    }
                    else if (propertyValues1[i].PropertyType != propertyValues2[i].PropertyType)
                    {
                        site.Log.Add(
                            LogEntryKind.Debug,
                            "The property type of property {0} in the two property tag array are not equal. The property type of propertyTag1 is {1}, the property type of propertyTag2 is {2}",
                            i,
                            propertyValues1[i].PropertyType,
                            propertyValues2[i].PropertyType);

                        return false;
                    }
                }
            }

            return true;
        }