public void TestGenerateFieldData() { FieldInfo field = typeof(FieldTestClass).GetField("ConstField"); utility.GenerateName(field).Returns("CSDocNet.TestDoc.FieldTestClass.ConstField"); utility.GenerateAttributes(field).Returns(new MemberRef[0]); idGen.GenerateMemberID(field).Returns("F:CSDocNet.TestDoc.FieldTestClass.ConstField"); var name = gen.GenerateName(field); var id = gen.GenerateCommentID(field); var access = gen.GenerateAccess(field); var modifiers = gen.GenerateModifiers(field); var attr = gen.GenerateAttributes(field); MemberData mData = gen.GenerateMemberData(field); FieldData fData = gen.GenerateFieldData(field); Assert.AreEqual(mData, fData.Member); Assert.AreEqual(666, fData.ConstValue); }
public void TestGenerateMethodData() { MethodInfo method = typeof(MethodTestClass).GetMethod("Method"); IReadOnlyList <MemberRef> expectedAttr = new MemberRef[] { new MemberRef("STAThreadAttribute", MemberRefType.Class, typeof(STAThreadAttribute).MetadataToken) }; docUtility.GenerateName(method).Returns("CSDocNet.TestDoc.MethodTestClass.Method"); docUtility.GenerateAttributes(method).Returns(expectedAttr); MemberData member = gen.GenerateMemberData(method); ReturnValue returnValue = gen.GenerateReturnValue(method); var parameters = methodUtility.GenerateParams(method.GetParameters()); var typeParams = methodUtility.GenerateTypeParams(method); MethodData mData = gen.GenerateMethodData(method); Assert.AreEqual(member, mData.Member); Assert.AreEqual(parameters.Count, mData.Params.Count); Assert.AreEqual(typeParams.Count, mData.TypeParams.Count); }
public void TestGenerateMemberData() { EventInfo ev = typeof(EventTestClass).GetEvent("PublicEvent"); IReadOnlyList <MemberRef> expectedAttr = new MemberRef[] { new MemberRef("STAThreadAttribute", MemberRefType.Class, typeof(STAThreadAttribute).MetadataToken) }; docUtility.GenerateName(ev).Returns("CSDocNet.TestDoc.EventTestClass.Event"); docUtility.GenerateAttributes(ev).Returns(expectedAttr); idGen.GenerateMemberID(ev).Returns("M:CSDocNet.TestDoc.EventTestClass.Event"); var name = gen.GenerateName(ev); var id = gen.GenerateCommentID(ev); var access = gen.GenerateAccess(ev); var modifiers = gen.GenerateModifiers(ev); var attr = gen.GenerateAttributes(ev); MemberData mData = gen.GenerateMemberData(ev); Assert.AreEqual(name, mData.Name); Assert.AreEqual(id, mData.CommentID); Assert.AreEqual(access, mData.Access); Assert.AreEqual(modifiers, mData.Modifiers); Assert.That(mData.Attributes, Is.EquivalentTo(attr)); }
public void TestGenerateMemberData() { MethodBase method = typeof(MethodTestClass).GetMethod("Method"); IReadOnlyList <MemberRef> expectedAttr = new MemberRef[] { new MemberRef("STAThreadAttribute", MemberRefType.Class, typeof(STAThreadAttribute).MetadataToken) }; docUtility.GenerateName(method).Returns("CSDocNet.TestDoc.MethodTestClass.Method"); docUtility.GenerateAttributes(method).Returns(expectedAttr); idGen.GenerateMemberID(method).Returns("M:CSDocNet.TestDoc.MethodTestClass.Method"); var name = methodUtility.GenerateName(method); var id = methodUtility.GenerateCommentID(method); var access = methodUtility.GenerateAccess(method); var modifiers = methodUtility.GenerateModifiers(method); var attr = methodUtility.GenerateAttributes(method); MemberData mData = methodUtility.GenerateMemberData(method); Assert.AreEqual(name, mData.Name); Assert.AreEqual(id, mData.CommentID); Assert.AreEqual(access, mData.Access); Assert.AreEqual(modifiers, mData.Modifiers); Assert.That(mData.Attributes, Is.EquivalentTo(attr)); }
public IReadOnlyList <MemberRef> GenerateAttributes(EventInfo member) { Check.Ref(member); return(docUtility.GenerateAttributes(member)); }
public IReadOnlyList <MemberRef> GenerateAttributes(FieldInfo member) { Check.Ref(member); return(utility.GenerateAttributes(member)); }