Exemplo n.º 1
0
        public void TestFieldWithPartialNameMatchAndExcludeBackingMembers()
        {
            Flags flags = Flags.InstanceAnyVisibility | Flags.PartialNameMatch;

            var expectedName = AnimalInstanceFieldNames.Where(s => s.Contains("Movement")).First();
            var field        = typeof(Animal).Field("Movement", flags);

            Assert.NotNull(field);
            Assert.Equal(expectedName, field.Name);

            field = typeof(Animal).Field("Movement", flags | Flags.ExcludeBackingMembers);
            Assert.Null(field);
        }
Exemplo n.º 2
0
        public void TestFieldByPartialName()
        {
            Flags flags = Flags.InstanceAnyVisibility | Flags.PartialNameMatch;

            var expectedName = AnimalInstanceFieldNames.Where(s => s.Contains("i")).First();
            var field        = typeof(Animal).Field("i", flags);

            Assert.NotNull(field);
            Assert.Equal(expectedName, field.Name);

            expectedName = AnimalInstanceFieldNames.Where(s => s.Contains("bi")).First();
            field        = typeof(Animal).Field("bi", flags);
            Assert.NotNull(field);
            Assert.Equal(expectedName, field.Name);
        }
Exemplo n.º 3
0
        public void TestFieldByPartialName()
        {
            FasterflectFlags flags = FasterflectFlags.InstanceAnyVisibility | FasterflectFlags.PartialNameMatch;

            string    expectedName = AnimalInstanceFieldNames.Where(s => s.Contains("i")).First();
            FieldInfo field        = typeof(Animal).Field("i", flags);

            Assert.IsNotNull(field);
            Assert.AreEqual(expectedName, field.Name);

            expectedName = AnimalInstanceFieldNames.Where(s => s.Contains("bi")).First();
            field        = typeof(Animal).Field("bi", flags);
            Assert.IsNotNull(field);
            Assert.AreEqual(expectedName, field.Name);
        }