Пример #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            PdxType other = obj as PdxType;

            if (other == null)
            {
                return(false);
            }

            if (other == this)
            {
                return(true);
            }

            compareByteByteArray(other.m_byteByteArray, m_byteByteArray);
            GenericValCompare(other.m_char, m_char);

            GenericValCompare(other.m_bool, m_bool);
            GenericCompare(other.m_boolArray, m_boolArray);

            GenericValCompare(other.m_byte, m_byte);
            GenericCompare(other.m_byteArray, m_byteArray);
            GenericCompare(other.m_charArray, m_charArray);

            compareCompareCollection(other.m_arraylist, m_arraylist);

            if (other.m_map.Count != m_map.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_map.GetType().ToString());
            }

            if (other.m_hashtable.Count != m_hashtable.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_hashtable.GetType().ToString());
            }

            if (other.m_vector.Count != m_vector.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_vector.GetType().ToString());
            }

            if (other.m_chs.Count != m_chs.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_chs.GetType().ToString());
            }

            if (other.m_clhs.Count != m_clhs.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_clhs.GetType().ToString());
            }


            GenericValCompare(other.m_string, m_string);

            compareData(other.m_dateTime, m_dateTime);

            GenericValCompare(other.m_double, m_double);

            GenericCompare(other.m_doubleArray, m_doubleArray);
            GenericValCompare(other.m_float, m_float);
            GenericCompare(other.m_floatArray, m_floatArray);
            GenericValCompare(other.m_int16, m_int16);
            GenericValCompare(other.m_int32, m_int32);
            GenericValCompare(other.m_long, m_long);
            GenericCompare(other.m_int32Array, m_int32Array);
            GenericCompare(other.m_longArray, m_longArray);
            GenericCompare(other.m_int16Array, m_int16Array);
            GenericValCompare(other.m_sbyte, m_sbyte);
            GenericCompare(other.m_sbyteArray, m_sbyteArray);
            GenericCompare(other.m_stringArray, m_stringArray);
            GenericValCompare(other.m_uint16, m_uint16);
            GenericValCompare(other.m_uint32, m_uint32);
            GenericValCompare(other.m_ulong, m_ulong);
            GenericCompare(other.m_uint32Array, m_uint32Array);
            GenericCompare(other.m_ulongArray, m_ulongArray);
            GenericCompare(other.m_uint16Array, m_uint16Array);

            if (m_byte252.Length != 252 && other.m_byte252.Length != 252)
            {
                throw new Exception("Array len 252 not found");
            }

            if (m_byte253.Length != 253 && other.m_byte253.Length != 253)
            {
                throw new Exception("Array len 253 not found");
            }

            if (m_byte65535.Length != 65535 && other.m_byte65535.Length != 65535)
            {
                throw new Exception("Array len 65535 not found");
            }

            if (m_byte65536.Length != 65536 && other.m_byte65536.Length != 65536)
            {
                throw new Exception("Array len 65536 not found");
            }
            if (m_pdxEnum != other.m_pdxEnum)
            {
                throw new Exception("pdx enum is not equal");
            }

            {
                for (int i = 0; i < m_address.Length; i++)
                {
                    if (!m_address[i].Equals(other.m_address[i]))
                    {
                        throw new Exception("Address array not mateched " + i);
                    }
                }
            }

            for (int i = 0; i < m_objectArray.Count; i++)
            {
                if (!m_objectArray[i].Equals(other.m_objectArray[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
        public void checkEquality(PdxTypesReflectionTest other)
        {
            byte[][] baa = other.m_byteByteArray;
            m_byteByteArray = compareByteByteArray(baa, m_byteByteArray);
            m_char          = GenericValCompare(other.m_char, m_char);

            m_bool      = GenericValCompare(other.m_bool, m_bool);
            m_boolArray = GenericCompare(other.m_boolArray, m_boolArray);

            m_byte      = GenericValCompare(other.m_byte, m_byte);
            m_byteArray = GenericCompare(other.m_byteArray, m_byteArray);
            m_charArray = GenericCompare(other.m_charArray, m_charArray);

            List <object> tmpl = new List <object>();

            m_arraylist = compareCompareCollection(other.m_arraylist, m_arraylist);

            m_LinkedList = compareCompareCollection(other.m_LinkedList, m_LinkedList);

            IDictionary <object, object> tmpM = other.m_map;

            if (tmpM.Count != m_map.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_map.GetType().ToString());
            }

            Hashtable tmpH = other.m_hashtable;

            if (tmpH.Count != m_hashtable.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_hashtable.GetType().ToString());
            }

            ArrayList arrAl = other.m_vector;

            if (arrAl.Count != m_vector.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_vector.GetType().ToString());
            }

            CacheableHashSet rmpChs = other.m_chs;

            if (rmpChs.Count != m_chs.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_chs.GetType().ToString());
            }

            CacheableLinkedHashSet rmpClhs = other.m_clhs;

            if (rmpClhs.Count != m_clhs.Count)
            {
                throw new IllegalStateException("Not got expected value for type: " + m_clhs.GetType().ToString());
            }


            m_string = GenericValCompare(other.m_string, m_string);

            m_dateTime = compareData(other.m_dateTime, m_dateTime);

            m_double = GenericValCompare(other.m_double, m_double);

            m_doubleArray = GenericCompare(other.m_doubleArray, m_doubleArray);
            m_float       = GenericValCompare(other.m_float, m_float);
            m_floatArray  = GenericCompare(other.m_floatArray, m_floatArray);
            m_int16       = GenericValCompare(other.m_int16, m_int16);
            m_int32       = GenericValCompare(other.m_int32, m_int32);
            m_long        = GenericValCompare(other.m_long, m_long);
            m_int32Array  = GenericCompare(other.m_int32Array, m_int32Array);
            m_longArray   = GenericCompare(other.m_longArray, m_longArray);
            m_int16Array  = GenericCompare(other.m_int16Array, m_int16Array);
            m_sbyte       = GenericValCompare(other.m_sbyte, m_sbyte);
            m_sbyteArray  = GenericCompare(other.m_sbyteArray, m_sbyteArray);
            m_stringArray = GenericCompare(other.m_stringArray, m_stringArray);
            m_uint16      = GenericValCompare(other.m_uint16, m_uint16);
            m_uint32      = GenericValCompare(other.m_uint32, m_uint32);
            m_ulong       = GenericValCompare(other.m_ulong, m_ulong);
            m_uint32Array = GenericCompare(other.m_uint32Array, m_uint32Array);
            m_ulongArray  = GenericCompare(other.m_ulongArray, m_ulongArray);
            m_uint16Array = GenericCompare(other.m_uint16Array, m_uint16Array);

            byte[] ret = other.m_byte252;
            if (ret.Length != 252)
            {
                throw new Exception("Array len 252 not found");
            }

            ret = other.m_byte253;
            if (ret.Length != 253)
            {
                throw new Exception("Array len 253 not found");
            }

            ret = other.m_byte65535;
            if (ret.Length != 65535)
            {
                throw new Exception("Array len 65535 not found");
            }

            ret = other.m_byte65536;
            if (ret.Length != 65536)
            {
                throw new Exception("Array len 65536 not found");
            }
            if (other.m_pdxEnum != m_pdxEnum)
            {
                throw new Exception("Pdx enum is not equal");
            }
            //byte[] m_byte252 = new byte[252];
            //byte[] m_byte253 = new byte[253];
            //byte[] m_byte65535 = new byte[65535];
            //byte[] m_byte65536 = new byte[65536];
            AddressR[] otherA = other.m_address;
            for (int i = 0; i < m_address.Length; i++)
            {
                if (!m_address[i].Equals(otherA[i]))
                {
                    throw new Exception("AddressR array is not equal " + i);
                }
            }
        }