예제 #1
0
        public void GetMethod()
        {
            var typeInt = new HybType(typeof(int));

            // derivered method
            Assert.AreEqual(
                true,
                typeInt.GetMethods()
                .Where(x => x.Id == nameof(int.GetType)).Count() > 0);
            // class method
            Assert.AreEqual(
                true,
                typeInt.GetMethods()
                .Where(x => x.Id == nameof(int.ToString)).Count() > 0);
        }
예제 #2
0
        public void GetStaticMethod()
        {
            var typeInt = new HybType(typeof(int));

            // static method
            Assert.AreEqual(
                true,
                typeInt.GetStaticMethods()
                .Where(x => x.Id == nameof(int.TryParse)).Count() > 0);

            // instance method should not be visible
            Assert.AreEqual(
                false,
                typeInt.GetStaticMethods()
                .Where(x => x.Id == nameof(int.ToString)).Count() > 0);
        }
예제 #3
0
        public void GetMethodAndAccessor()
        {
            var typeInt = new HybType(typeof(Foo));

            Assert.AreEqual(
                true,
                typeInt.GetMethods()
                .Where(x => x.Id == nameof(Foo.Public)).Count() > 0);
            Assert.AreEqual(
                true,
                typeInt.GetMethods()
                .Where(x => x.Id == "Protected").Count() > 0);
            Assert.AreEqual(
                false,
                typeInt.GetMethods()
                .Where(x => x.Id == "Private").Count() > 0);
        }