Esempio n. 1
0
        public void cacheTest4()
        {
            /*
             *  MethodInfo m = typeof(T).GetMethod("Invoke"); - local
             *  TDyn type = ...from cache
             *  type.dynamic.CreateDelegate(...)
             *     - type.declaringType - failed from another cached TDyn
             *     - m.DeclaringType - should be ok
             *
             *  see `T getDelegate<T>(IntPtr ptr, CallingConvention conv) where T : class`
             */

            using (dynamic l = new ConariX(gCfgUnlib))
            {
                Assert.Equal(7, l.get_Seven <ushort>());
                Assert.Equal(7, l.bind <Func <ushort> >("get_Seven")());

                Assert.Equal(7, l.get_Seven <ushort>());
                Assert.Equal(7, l.bind <Func <ushort> >("get_Seven")());
            }

            using (dynamic l = new ConariX(gCfgUnlib))
            {
                Assert.Equal(7, l.bind <Func <ushort> >("get_Seven")());
                Assert.Equal(7, l.get_Seven <ushort>());

                Assert.Equal(7, l.bind <Func <ushort> >("get_Seven")());
                Assert.Equal(7, l.get_Seven <ushort>());
            }
        }
Esempio n. 2
0
 public void basicTest2()
 {
     using (dynamic l = new ConariX(gCfgUnlib))
     {
         Assert.Equal(7, l.get_Seven <ushort>());
         Assert.Equal(7, l.bind <Func <ushort> >("get_Seven")());
         Assert.Equal((ushort)7, l.bind(Dynamic.GetMethodInfo(typeof(ushort)), "get_Seven")
                      .dynamic
                      .Invoke(null, Array.Empty <object>()));
     }
 }
Esempio n. 3
0
        public void basicTest7()
        {
            using (dynamic l = new ConariX(gCfgUnlib))
            {
                Assert.Equal((UserSpecUintType)7, l.get_Seven <UserSpecUintType>());
                Assert.Equal((UserSpecUintType)7, l.bind <Func <UserSpecUintType> >("get_Seven")());

                Assert.Equal((UserSpecUintType)7,
                             l.bind(Dynamic.GetMethodInfo(typeof(UserSpecUintType)), "get_Seven")
                             .dynamic
                             .Invoke(null, Array.Empty <object>()));
            }
        }