示例#1
0
        public void TestAddNewAPIWrongParam()
        {
            API.AddNewAPI("GCounter", "GetValue", "g", "testMistake");

            CRDTypeInfo gctypeinfo = API.typeList[typeof(RAC.Operations.GCounter)];
            MethodInfo method;
            Assert.False(gctypeinfo.methodsList.TryGetValue("g", out method));
        }
示例#2
0
        public void TestAddNewAPIWithParam()
        {
            API.StringToType stt = delegate(string x) { return (object)x; };
            API.TypeToString tts = delegate(object x) { return ((string)x); };

            API.AddConverter("test", stt, tts);

            API.AddNewAPI("GCounter", "GetValue", "g", "test");

            CRDTypeInfo gctypeinfo = API.typeList[typeof(RAC.Operations.GCounter)];
            MethodInfo method;
            List<string> plst;

            Assert.True(gctypeinfo.methodsList.TryGetValue("g", out method));
            Assert.True(gctypeinfo.paramsList.TryGetValue("g", out plst));
            Assert.Equal("test", plst[0]);
        }