示例#1
0
        /// <summary>
        /// Verify whether this structure is expected
        /// </summary>
        /// <param name="complexValue">Specifies an MA complex type.</param>
        /// <returns>If succeeded, return TRUE, else return FALSE.</returns>
        public bool Verify(ComplexType complexValue)
        {
            // Get the structure by using field name
            ComplexType value;

            if (!MAVerifyUtil.GetFieldValue <ComplexType>(FieldName, complexValue, out value))
            {
                return(false);
            }

            // Verify the verifyList
            if (VerifyItemList != null)
            {
                if (!VerifyItemList.Verify(value))
                {
                    return(false);
                }
            }

            // Verify sub-structures
            if (Structures != null)
            {
                foreach (StructureField structure in Structures)
                {
                    if (!structure.Verify(value))
                    {
                        return(false);
                    }
                }
            }

            // Verify arrays in this structure
            if (Arrays != null)
            {
                foreach (ArrayField array in Arrays)
                {
                    if (!array.Verify(value))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
示例#2
0
        /// <summary>
        /// Verify whether this array is expected
        /// </summary>
        /// <param name="complexValue">MA complex value</param>
        /// <returns>If succeeded, return TRUE, else return FALSE.</returns>
        public bool Verify(ComplexType complexValue)
        {
            // Get the array by using field name
            Array elements;

            if (!MAVerifyUtil.GetFieldValue <Array>(FieldName, complexValue, out elements))
            {
                return(false);
            }
            if (elements == null)
            {
                return(false);
            }
            // Verify array items
            foreach (ArrayItem item in ArrayItems)
            {
                if (!ContainValidItem(elements, item))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#3
0
 /// <summary>
 /// Verify whether the value applies this verify item
 /// </summary>
 /// <param name="complexValue">MA complexValue</param>
 /// <returns>If succeeded, return TRUE, else return FALSE.</returns>
 public bool Verify(Object value)
 {
     return(MAVerifyUtil.VerifyValue(value, this));
 }