Exemple #1
0
        public void TestFindInstanceMethod()
        {
            MethodInfo method = typeof(object).Method("ID");

            Assert.Null(method);

            AnimalInstanceMethodNames.Select(s => typeof(Animal).Method(s)).ForEach(Assert.NotNull);
            SnakeInstanceMethodNames.Select(s => typeof(Snake).Method(s)).ForEach(Assert.NotNull);
        }
Exemple #2
0
        public void TestFindMethodInstanceIgnoreCase()
        {
            Flags flags = Flags.InstanceAnyVisibility | Flags.IgnoreCase;

            AnimalInstanceMethodNames.Select(s => s.ToLower()).Select(s => typeof(Animal).Method(s)).ForEach(Assert.Null);
            AnimalInstanceMethodNames.Select(s => s.ToLower()).Select(s => typeof(Animal).Method(s, flags)).ForEach(Assert.NotNull);

            ReptileInstanceMethodNames.Select(s => s.ToLower()).Select(s => typeof(Reptile).Method(s)).ForEach(Assert.Null);
            ReptileInstanceMethodNames.Select(s => s.ToLower()).Select(s => typeof(Reptile).Method(s, flags)).ForEach(Assert.NotNull);

            SnakeInstanceMethodNames.Select(s => s.ToLower()).Select(s => typeof(Snake).Method(s)).ForEach(Assert.Null);
            SnakeInstanceMethodNames.Select(s => s.ToLower()).Select(s => typeof(Snake).Method(s, flags)).ForEach(Assert.NotNull);
        }
Exemple #3
0
        public void TestFindMethodInstanceWithExcludeBackingMembers()
        {
            Flags flags = Flags.InstanceAnyVisibility | Flags.ExcludeBackingMembers;

            AnimalInstanceMethodNames.Select(s => typeof(Animal).Method(s)).ForEach(Assert.NotNull);
            AnimalInstanceMethodNames.Where(s => s.Contains("_")).Select(s => typeof(Animal).Method(s, flags)).ForEach(Assert.Null);
            AnimalInstanceMethodNames.Where(s => !s.Contains("_")).Select(s => typeof(Animal).Method(s, flags)).ForEach(Assert.NotNull);

            ReptileInstanceMethodNames.Select(s => typeof(Reptile).Method(s)).ForEach(Assert.NotNull);
            ReptileInstanceMethodNames.Where(s => s.Contains("_")).Select(s => typeof(Reptile).Method(s, flags)).ForEach(Assert.Null);
            ReptileInstanceMethodNames.Where(s => !s.Contains("_")).Select(s => typeof(Reptile).Method(s, flags)).ForEach(Assert.NotNull);

            SnakeInstanceMethodNames.Select(s => typeof(Snake).Method(s)).ForEach(Assert.NotNull);
            SnakeInstanceMethodNames.Where(s => s.Contains("_")).Select(s => typeof(Snake).Method(s, flags)).ForEach(Assert.Null);
            SnakeInstanceMethodNames.Where(s => !s.Contains("_")).Select(s => typeof(Snake).Method(s, flags)).ForEach(Assert.NotNull);
        }