Пример #1
0
        /// <summary>
        /// This method is to verify whether a message is expected.
        /// </summary>
        /// <param name="message">An MA message</param>
        /// <param name="endpointRoles">Specifies the Endpoint Roles.</param>
        /// <returns>true if the message is expected, otherwise return false.</returns>
        public bool Verify(Message message, Dictionary <string, EndpointRole> endpointRoles)
        {
            // Verify type name
            if (!message.TypeName.ToLower(CultureInfo.InvariantCulture).Equals(this.Name.ToLower(CultureInfo.InvariantCulture)))
            {
                return(false);
            }

            // Verify address
            if (!VerifyAddress(message, endpointRoles))
            {
                return(false);
            }

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

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

            // Verify Arrays
            if (Arrays != null)
            {
                foreach (ArrayField array in Arrays)
                {
                    if (!array.Verify(message))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Пример #2
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);
        }
Пример #3
0
        /// <summary>
        /// Verify whether this array item is expected
        /// </summary>
        /// <param name="complexValue">complexValue from array</param>
        /// <returns>If succeeded, return TRUE, else return FALSE.</returns>
        public bool Verify(Object value)
        {
            // Verify verify list
            if (VerifyItemList != null)
            {
                if (!VerifyItemList.Verify(value))
                {
                    return(false);
                }
            }

            if (value is ComplexType)
            {
                ComplexType complexValue = (ComplexType)value;
                // Veiry structures
                if (Structures != null)
                {
                    foreach (StructureField structure in Structures)
                    {
                        if (!structure.Verify(complexValue))
                        {
                            return(false);
                        }
                    }
                }

                // Verify Arrays
                if (Arrays != null)
                {
                    foreach (ArrayField array in Arrays)
                    {
                        if (!array.Verify(complexValue))
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }