Beispiel #1
0
 public void InvokeEmptyMethodTest()
 {
     var c = new JScriptAssemblyCreator { ClassName = "TestClass" };
     c.AddMethod("TestM", "public", null, null, "");
     var i = c.Compile();
     i.Invoke("TestM");
 }
Beispiel #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"));
        }
Beispiel #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"));
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #6
0
 public void InvalidMethodTest()
 {
     var c = new JScriptAssemblyCreator { ClassName = "TestClass" };
     var i = c.Compile();
     Assert.Throws<MissingMethodException>(() => i.Invoke("asdf"));
 }