コード例 #1
0
 public void InvokeEmptyMethodTest()
 {
     var c = new JScriptAssemblyCreator { ClassName = "TestClass" };
     c.AddMethod("TestM", "public", null, null, "");
     var i = c.Compile();
     i.Invoke("TestM");
 }
コード例 #2
0
        public void InvokeAsStringWithParamsTest()
        {
            var c = new JScriptAssemblyCreator { ClassName = "TestClass" };
            c.AddMethod("TestM", "public", "String", "a", "return \"hi \" + a;");
            var i = c.Compile();

            Assert.AreEqual("hi loser", i.InvokeAsString("TestM", "loser"));
        }
コード例 #3
0
        public void InvokeAsStringTest()
        {
            var c = new JScriptAssemblyCreator { ClassName = "TestClass" };
            c.AddMethod("TestM", "public", "String", null, "return \"hi\";");
            var i = c.Compile();

            Assert.AreEqual("hi", i.InvokeAsString("TestM"));
        }
コード例 #4
0
        public void AddMethodOneParameterTest()
        {
            var c = new JScriptAssemblyCreator { ClassName = "TestClass" };
            c.AddMethod("TestM", "public", "String", "a", "return \"hi \" + a;");

            Assembly asm;
            c.Compile(out asm);

            Assert.IsNotNull(asm);
        }
コード例 #5
0
        public void AddEmptyMethodTest()
        {
            var c = new JScriptAssemblyCreator { ClassName = "TestClass" };
            c.AddMethod("TestM", "public", null, null, "");

            Assembly asm;
            c.Compile(out asm);

            Assert.IsNotNull(asm);
        }
コード例 #6
0
 public void InvalidMethodTest()
 {
     var c = new JScriptAssemblyCreator { ClassName = "TestClass" };
     var i = c.Compile();
     Assert.Throws<MissingMethodException>(() => i.Invoke("asdf"));
 }