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);
        }
Example #2
0
        public void GetMemberModifiers_PublicMethod()
        {
            var memberInfo = typeof(MemberModifierTestClass).GetMember("PublicMethod")[0];

            var output = _memberModifierUtility.GetMemberModifiers(memberInfo);

            Assert.That(output, Is.EqualTo("public"));
        }