This define the base class for a property value node
Inheritance: Microsoft.Protocols.TestSuites.Common.Node
コード例 #1
0
        /// <summary>
        /// Verify the AddressBookPropertyValue structure related requirements.
        /// </summary>
        /// <param name="addressBookPropertyValue">The AddressBookPropertyValue value to be verified.</param>
        private void VerifyAddressBookPropertyValueStructure(AddressBookPropertyValue addressBookPropertyValue)
        {
            // Since Test Suite parsed AddressBookPropertyValue structure according to Specification, if the program run to here, R2000 can be verified directly.
            this.Site.CaptureRequirement(
                2000,
                @"[In AddressBookPropertyValue Structure] The AddressBookPropertyValue structure includes a property value.");

                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2004");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2005");

            bool isVerifyR2005 = addressBookPropertyValue.HasValue == 0xFF || addressBookPropertyValue.HasValue == 0x00;

            if (addressBookPropertyValue.HasValue != null)
            {
                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2005
                this.Site.CaptureRequirementIfIsTrue(
                    isVerifyR2005,
                    2005,
                    @"[In AddressBookPropertyValue Structure] [HasValue] This field MUST contain either TRUE (0xFF) or FALSE (0x00). ");
            }
        }
コード例 #2
0
        /// <summary>
        /// Parse the AddressBookPropertyRow structure.
        /// </summary>
        /// <param name="rawBuffer">The raw data returned from server.</param>
        /// <param name="propTagArray">The list of property tags.</param>
        ///  <param name="index">The start index.</param>
        /// <returns>Return an instance of AddressBookPropertyRow.</returns>
        public static AddressBookPropertyRow Parse(byte[] rawBuffer, LargePropertyTagArray propTagArray, ref int index)
        {
            AddressBookPropertyRow addressBookPropertyRow = new AddressBookPropertyRow();

            addressBookPropertyRow.Flag = rawBuffer[index];
            index++;
            List <AddressBookPropertyValue> valueArray = new List <AddressBookPropertyValue>();

            Context.Instance.PropertyBytes = rawBuffer;
            Context.Instance.CurIndex      = index;
            Context.Instance.CurProperty   = new Property(PropertyType.PtypUnspecified);

            // If the value of the Flags field is set to 0x00: The array contains either a AddressBookPropertyValue structure, or a AddressBookTypedPropertyValue structure.
            // If the value of the Flags field is set to 0x01: The array contains either a AddressBookFlaggedPropertyValue structure, or a AddressBookFlaggedPropertyValueWithType structure.
            if (addressBookPropertyRow.Flag == 0x00)
            {
                foreach (PropertyTag propertyTag in propTagArray.PropertyTags)
                {
                    if (propertyTag.PropertyType == 0x0000)
                    {
                        // If the value of the Flags field is set to 0x00: The array contains a AddressBookTypedPropertyValue structure, if the type of property is PtyUnspecified.
                        AddressBookTypedPropertyValue typedPropertyValue = new AddressBookTypedPropertyValue();

                        // Parse the AddressBookTypedPropertyValue with the instance of the context which contains the datas and start index.
                        typedPropertyValue.Parse(Context.Instance);
                        valueArray.Add(typedPropertyValue);
                        index = Context.Instance.CurIndex;
                    }
                    else
                    {
                        // If the value of the Flags field is set to 0x00: The array contains a AddressBookPropertyValue structure, if the type of property is specified.
                        Context.Instance.CurProperty.Type = (PropertyType)propertyTag.PropertyType;
                        AddressBookPropertyValue propertyValue = new AddressBookPropertyValue();

                        // Parse the AddressBookTypedPropertyValue with the instance of the context which contains the datas and start index.
                        propertyValue.Parse(Context.Instance);
                        valueArray.Add(propertyValue);
                        index = Context.Instance.CurIndex;
                    }
                }
            }
            else if (addressBookPropertyRow.Flag == 0x01)
            {
                foreach (PropertyTag propertyTag in propTagArray.PropertyTags)
                {
                    if (propertyTag.PropertyType == 0x0000)
                    {
                        // If the value of the Flags field is set to 0x01: The array contains a AddressBookFlaggedPropertyValueWithType structure, if the type of property is PtyUnspecified.
                        AddressBookFlaggedPropertyValueWithType flaggedPropertyValue = new AddressBookFlaggedPropertyValueWithType();

                        // Parse the AddressBookTypedPropertyValue with the instance of the context which contains the datas and start index.
                        flaggedPropertyValue.Parse(Context.Instance);
                        valueArray.Add(flaggedPropertyValue);
                        index = Context.Instance.CurIndex;
                    }
                    else
                    {
                        // If the value of the Flags field is set to 0x01: The array contains a AddressBookFlaggedPropertyValue structure, if the type of property is specified.
                        Context.Instance.CurProperty.Type = (PropertyType)propertyTag.PropertyType;
                        AddressBookFlaggedPropertyValue propertyValue = new AddressBookFlaggedPropertyValue();

                        // Parse the AddressBookTypedPropertyValue with the instance of the context which contains the datas and start index.
                        propertyValue.Parse(Context.Instance);
                        valueArray.Add(propertyValue);
                        index = Context.Instance.CurIndex;
                    }
                }
            }

            addressBookPropertyRow.ValueArray = valueArray.ToArray();

            return(addressBookPropertyRow);
        }