private XElement CreateMemberElement(InvolvedTypeMember member)
        {
            MemberInfo memberInfo = member.MemberInfo;

            var memberModifier = _memberModifierUtility.GetMemberModifiers(memberInfo);

            if (memberModifier.Contains("private")) // memberModifier.Contains ("internal")
            {
                return(null);
            }

            var memberName = GetMemberName(memberInfo);

            var attributes = new StringBuilder();

            XElement overridesElement  = null;
            XElement overriddenElement = null;

            if (_involvedType != null)
            {
                if (HasOverrideMixinAttribute(memberInfo))
                {
                    attributes.Append("OverrideMixin ");
                }
                if (HasOverrideTargetAttribute(memberInfo))
                {
                    attributes.Append("OverrideTarget ");
                }

                overridesElement  = CreateOverridesElement(member);
                overriddenElement = CreateOverriddenElement(member.MemberInfo);
            }

            if (memberInfo.DeclaringType != _type &&
                overridesElement == null && overriddenElement == null)
            {
                return(null);
            }

            var element = new XElement("Member", new XAttribute("id", _memberIdentifierGenerator.GetIdentifier(memberInfo)),
                                       new XAttribute("metadataToken", GetMetadataToken(memberInfo)),
                                       new XAttribute("type", memberInfo.MemberType),
                                       new XAttribute("name", memberName),
                                       new XAttribute("is-declared-by-this-class", memberInfo.DeclaringType == _type),
                                       _outputFormatter.CreateModifierMarkup(attributes.ToString(), memberModifier),
                                       _memberSignatureUtility.GetMemberSignature(memberInfo),
                                       member.SubMemberInfos.Select(CreateSubMemberElement),
                                       overridesElement,
                                       overriddenElement);

            return(element);
        }
예제 #2
0
        public void GetMemberSignature_MethodWithParams()
        {
            var methodInfo     = typeof(MemberSignatureTestClass).GetMethod("MethodWithParams");
            var output         = _memberSignatureUtility.GetMemberSignature(methodInfo);
            var expectedOutput = _outputFormatter.CreateMethodMarkup(methodInfo.Name, methodInfo.ReturnType, methodInfo.GetParameters());

            Assert.That(output.ToString(), Is.EqualTo(expectedOutput.ToString()));
        }