public void namingTest1() { using (dynamic l = new ConariX(UNLIB_DLL, true, "apiprefix_")) { Assert.Equal(4, l.GetMagicNum <int>()); Assert.Equal(4, l.bind <Func <int> >("GetMagicNum")()); Assert.Equal(-1, l.bindFunc <Func <int> >("GetMagicNum")()); Assert.Equal(-1, l.bind(Dynamic.GetMethodInfo(typeof(int)), "GetMagicNum").dynamic.Invoke(null, null)); Assert.Equal(-1, l.bindFunc <int>("GetMagicNum", typeof(int))()); Assert.Equal(4, l.bind <int>("GetMagicNum", typeof(int))()); } }
public void cacheTest2() { using (dynamic l = new ConariX(gCfgUnlib)) { Assert.Equal(7, l.bindFunc <int>("get_VarSeven", typeof(int))()); Assert.Null(l.bind("set_VarSeven", typeof(void), typeof(int))(1024)); Assert.Equal(1024, l.bind <int>("get_VarSeven", typeof(int))()); Assert.Null(l.bind("set_VarSeven", typeof(void), typeof(int))(-4096)); Assert.Equal(-4096, l.bind <int>("get_VarSeven", typeof(int))()); } }
public void basicTest12() { using (dynamic l = new ConariX(UNLIB_DLL, true)) { Assert.Equal(7, l.bindFunc <int>("get_VarSeven", typeof(int))()); Assert.Null(l.bind("set_VarSeven", typeof(void), typeof(int))(5)); Assert.Equal(5, l.bind <int>("get_VarSeven", typeof(int))()); Assert.Null(l.bind("reset_VarSeven", null)()); Assert.Equal(-1, (int)l.bind("get_VarSeven", typeof(int))()); } }
public void cacheTest3() { using (dynamic l = new ConariX(gCfgUnlib)) { Assert.Equal(7, l.bindFunc <Func <int> >("get_VarSeven")()); l.bind <Action <int> >("set_VarSeven")(1024); Assert.Equal(1024, l.bind <Func <int> >("get_VarSeven")()); l.bind <Action <int> >("set_VarSeven")(-4096); Assert.Equal(-4096, l.bind <Func <int> >("get_VarSeven")()); } }