public void GetEnumMemberTest() { var provider = new MemberProvider(); var member = provider.GetMembers(typeof(EnumMemberMock)).Single(); Assert.AreEqual(typeof(EnumMemberMock).FullName, member.Type.FullName); Assert.AreEqual(nameof(EnumMemberMock.EnumMember), member.Name); Assert.AreEqual(77, Convert.ToInt32(member.Value)); Assert.AreEqual(MemberInfoType.EnumMember, member.MemberInfoType); }
public void GetClassPublicFieldTest() { var provider = new MemberProvider() { IncludeProperties = false, IncludeFields = true, IncludeInternal = false, }; var member = provider.GetMembers(typeof(FieldMemberClassMock)).Single(); Assert.AreEqual(typeof(string).FullName, member.Type.FullName); Assert.AreEqual(nameof(FieldMemberClassMock.PublicField), member.Name); Assert.IsNull(member.Value); Assert.AreEqual(MemberInfoType.Field, member.MemberInfoType); }
public void GetClassProtectedFieldTest() { var provider = new MemberProvider() { IncludeProperties = false, IncludeFields = true, IncludeInternal = true, }; var members = provider.GetMembers(typeof(FieldMemberClassMock)).OrderBy(m => m.Name).ToList(); Assert.AreEqual(2, members.Count); Assert.AreEqual(typeof(string).FullName, members[0].Type.FullName); Assert.AreEqual(nameof(FieldMemberClassMock.InternalField), members[0].Name); Assert.IsNull(members[0].Value); Assert.AreEqual(MemberInfoType.Field, members[0].MemberInfoType); Assert.AreEqual(typeof(string).FullName, members[1].Type.FullName); Assert.AreEqual(nameof(FieldMemberClassMock.PublicField), members[1].Name); Assert.IsNull(members[1].Value); Assert.AreEqual(MemberInfoType.Field, members[1].MemberInfoType); }