Esempio n. 1
0
        public void ReflectionExtension_can_find_methods_from_base_classes()
        {
            // all classes inherits from Object and Object has ToString() method!
            var instance = new Inheritor();
            var method   = instance.GetType().FindMethodRecursively("ToString");

            Assert.NotNull(method);
        }
Esempio n. 2
0
        public void ReflectionExtension_throws_when_unable_to_find_method()
        {
            // all classes inherits from Object and Object has ToString() method!
            var instance  = new Inheritor();
            var exception = Record.Exception(() => instance.GetType().FindMethodRecursively("IfThisIsHereStuffIsWhack"));

            Assert.NotNull(exception);
            var argumentException = Assert.IsType <ArgumentException>(exception);

            Assert.Equal("name", argumentException.ParamName);
        }