Exemple #1
0
        public void TestPublicPropertyFinderConvention()
        {
            var convention = new PublicMemberFinderConvention();

            var properties = convention.FindMembers(typeof(TestClass)).ToList();

            Assert.AreEqual(3, properties.Count);
            Assert.IsTrue(properties.Any(x => x.Name == "Public"));
            Assert.IsTrue(properties.Any(x => x.Name == "PrivateWrite"));
            Assert.IsTrue(properties.Any(x => x.Name == "PrivateRead"));
        }
        public void TestPublicPropertyFinderConvention()
        {
#pragma warning disable 618 // obsoleted by IMemberFinderConvention
            var convention = new PublicMemberFinderConvention();
            var properties = convention.FindMembers(typeof(TestClass)).ToList();
#pragma warning restore 618

            Assert.AreEqual(3, properties.Count);
            Assert.IsTrue(properties.Any(x => x.Name == "Public"));
            Assert.IsTrue(properties.Any(x => x.Name == "PrivateWrite"));
            Assert.IsTrue(properties.Any(x => x.Name == "PrivateRead"));
        }
 public IEnumerable <System.Reflection.MemberInfo> FindMembers(Type type)
 {
     return(convention.FindMembers(type).Where(mi => !mi.Name.StartsWith("_")));
 }