コード例 #1
0
        public bool Compare()
        {
            bool result = true;

            if (this.m_Value != null && this.m_Clone != null)
            {
                Type           type       = this.m_Value.GetType();
                PropertyInfo[] properties = type.GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    if (property.Name == "Item" || property.Name == "PublishedDocument")
                    {
                        continue;
                    }

                    if (property.PropertyType.FullName.Contains("System") == false ||
                        property.PropertyType.FullName.Contains("Collection") == true ||
                        property.PropertyType.FullName.Contains("List") == true)
                    {
                        if (property.PropertyType.FullName.Contains("Collection") == false && property.PropertyType.FullName.Contains("List") == false)
                        {
                            object object1           = property.GetValue(this.m_Value, null);
                            object object2           = property.GetValue(this.m_Clone, null);
                            DocumentTestBuilders dtb = new DocumentTestBuilders(object1, object2);
                            result = dtb.Compare();
                            if (result == false)
                            {
                                break;
                            }
                        }
                        else
                        {
                            result = this.HandleCollection(property, this.m_Value, this.m_Clone);
                            if (result == false)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        PersistenceHelper persistenceHelper = new PersistenceHelper();
                        result = PersistenceHelper.ArePropertiesEqual(property, this.m_Value, this.m_Clone);
                        if (result == false)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                result = this.CheckNulls(this.m_Value, this.m_Clone);
                if (result == false)
                {
                    string s = "nope";
                }
            }
            return(result);
        }
コード例 #2
0
        public bool Compare()
        {
            bool result = true;
            if(this.m_Value != null && this.m_Clone != null)
            {
                Type type = this.m_Value.GetType();
                PropertyInfo[] properties = type.GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    if(property.Name == "Item" || property.Name == "PublishedDocument")
                    {
                        continue;
                    }

                    if (property.PropertyType.FullName.Contains("System") == false ||
                        property.PropertyType.FullName.Contains("Collection") == true ||
                        property.PropertyType.FullName.Contains("List") == true)
                    {
                        if (property.PropertyType.FullName.Contains("Collection") == false && property.PropertyType.FullName.Contains("List") == false)
                        {
                            object object1 = property.GetValue(this.m_Value, null);
                            object object2 = property.GetValue(this.m_Clone, null);
                            DocumentTestBuilders dtb = new DocumentTestBuilders(object1, object2);
                            result = dtb.Compare();
                            if (result == false)
                                break;
                        }
                        else
                        {
                            result = this.HandleCollection(property, this.m_Value, this.m_Clone);
                            if (result == false)
                                break;
                        }
                    }
                    else
                    {
                        PersistenceHelper persistenceHelper = new PersistenceHelper();
                        result = PersistenceHelper.ArePropertiesEqual(property, this.m_Value, this.m_Clone);
                        if (result == false)
                            break;
                    }
                }
            }
            else
            {
                result = this.CheckNulls(this.m_Value, this.m_Clone);
                if (result == false)
                {
                    string s = "nope";
                }
            }
            return result;
        }
コード例 #3
0
        private bool HandleCollection(PropertyInfo property, object object1, object object2)
        {
            bool result = true;

            if (property.Name == "ValidationErrors")
            {
                return(result);
            }

            IList collectionObjects1 = (IList)property.GetValue(object1, null);
            IList collectionObjects2 = (IList)property.GetValue(object2, null);

            if (collectionObjects1 == null || collectionObjects2 == null)
            {
                result = CheckNulls(collectionObjects1, collectionObjects2);
            }
            else
            {
                if (collectionObjects1.Count != collectionObjects2.Count)
                {
                    result = false;
                }
                else
                {
                    for (int idx = 0; idx < collectionObjects1.Count; idx++)
                    {
                        DocumentTestBuilders dtb = new DocumentTestBuilders(collectionObjects1[idx], collectionObjects2[idx]);
                        result = dtb.Compare();
                        if (result == false)
                        {
                            break;
                        }
                    }
                }
            }
            return(result);
        }
コード例 #4
0
        private bool HandleCollection(PropertyInfo property, object object1, object object2)
        {
            bool result = true;

            if(property.Name == "ValidationErrors")
            {
                return result;
            }

            IList collectionObjects1 = (IList)property.GetValue(object1, null);
            IList collectionObjects2 = (IList)property.GetValue(object2, null);

            if (collectionObjects1 == null || collectionObjects2 == null)
            {
                result = CheckNulls(collectionObjects1, collectionObjects2);
            }
            else
            {
                if (collectionObjects1.Count != collectionObjects2.Count)
                {
                    result = false;
                }
                else
                {
                    for (int idx = 0; idx < collectionObjects1.Count; idx++)
                    {
                        DocumentTestBuilders dtb = new DocumentTestBuilders(collectionObjects1[idx], collectionObjects2[idx]);
                        result = dtb.Compare();
                        if (result == false)
                            break;
                    }
                }
            }
            return result;
        }