예제 #1
0
        public void Reply_CurrentUser_Not_Initialized()
        {
            var rs = new RiveScriptEngine();
            var oh = new CSharpObjectHandler(rs);

            oh.Load("test", new string[] { "return rs.currentUser();" });

            var result = oh.Call("test", rs, new string[] { "" });

            Assert.AreEqual(Constants.Undefined, result);
        }
예제 #2
0
        public void Reply_RS_Instance()
        {
            var rs = new RiveScriptEngine();
            var oh = new CSharpObjectHandler(rs);

            oh.Load("test", new string[] { "return rs.GetHashCode().ToString(); " });

            var result = oh.Call("test", rs, new string[] { "" });

            Assert.AreEqual(rs.GetHashCode().ToString(), result);
        }
예제 #3
0
        public void Reply_Concatenet_Args_Id()
        {
            var rs = new RiveScriptEngine();
            var oh = new CSharpObjectHandler(rs);

            oh.Load("test", new string[] { "return String.Join(\",\", args); " });

            var result = oh.Call("test", rs, new string[] { "1", "2", "3" });

            Assert.AreEqual("1,2,3", result);
        }
예제 #4
0
        public void Hello_World_Simple_Code_AndChsrpHandlerIsDefault()
        {
            var rs = new RiveScriptEngine();
            var oh = new CSharpObjectHandler(rs);

            oh.Load("test", new string[] { "return \"Hello world\"; " });

            var result = oh.Call("test", rs, new string[] { "" });

            Assert.AreEqual("Hello world", result);
        }