예제 #1
0
        private bool IsTheSame(Indexer comparisonIndexer, ComparisonDepth depth)
        {
            if (comparisonIndexer == null)
            {
                return(false);
            }

            if (Name == comparisonIndexer.Name &&
                DataType == comparisonIndexer.DataType &&
                Parameters.Count == comparisonIndexer.Parameters.Count)
            {
                for (int i = 0; i < Parameters.Count; i++)
                {
                    if (Parameters[i].Name != comparisonIndexer.Parameters[i].Name ||
                        Parameters[i].DataType != comparisonIndexer.Parameters[i].DataType)
                    {
                        return(false);
                    }
                }
                // Function names are the same, so now compare the class names
                // TODO: Parent object comparison
                //if (ParentObject.IsTheSame(comparisonIndexer.ParentObject))
                {
                    if (depth == ComparisonDepth.Signature)
                    {
                        return(true);
                    }

                    if (!base.IsTheSame(comparisonIndexer, depth))
                    {
                        return(false);
                    }

                    if (depth == ComparisonDepth.Outer)
                    {
                        return(true);
                    }

                    if (!GetAccessor.IsTheSame(comparisonIndexer.GetAccessor))
                    {
                        ComparisonDifference += GetType().Name + ".GetAccessor";
                        return(false);
                    }
                    if (!SetAccessor.IsTheSame(comparisonIndexer.SetAccessor))
                    {
                        ComparisonDifference += GetType().Name + ".SetAccessor";
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }
예제 #2
0
        private bool IsTheSame(Property comparisonProperty, ComparisonDepth depth)
        {
            if (comparisonProperty == null)
            {
                return(false);
            }

            if (Name == comparisonProperty.Name)
            {
                if (depth == ComparisonDepth.Signature)
                {
                    return(true);
                }

                if (DataType != comparisonProperty.DataType)
                {
                    return(false);
                }
                if (!base.IsTheSame(comparisonProperty, depth))
                {
                    return(false);
                }
                if (!Utility.StringCollectionsAreTheSame(Modifiers, comparisonProperty.Modifiers))
                {
                    ComparisonDifference += GetType().Name + ".Modifiers";
                    return(false);
                }

                if (depth == ComparisonDepth.Outer)
                {
                    return(true);
                }

                if (!GetAccessor.IsTheSame(comparisonProperty.GetAccessor))
                {
                    ComparisonDifference += GetType().Name + ".GetAccessor";
                    return(false);
                }
                if (!SetAccessor.IsTheSame(comparisonProperty.SetAccessor))
                {
                    ComparisonDifference += GetType().Name + ".SetAccessor";
                    return(false);
                }
                return(true);
            }
            return(false);
        }
        public void PropertyAccessor_()
        {
            PropertyAccessor inter = new PropertyAccessor(controller);
            inter.Name = "File";
            inter.Modifier = "protected";
            inter.BodyText = "lkajsdflkjasdlkfjasldfj";
            inter.AccessorType = PropertyAccessor.AccessorTypes.Set;

            Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True);
            Assert.That(string.IsNullOrEmpty(((PropertyAccessor)inter.Clone()).BodyText), Is.True);
        }