public void InvokeEmptyMethodTest() { var c = new JScriptAssemblyCreator { ClassName = "TestClass" }; c.AddMethod("TestM", "public", null, null, ""); var i = c.Compile(); i.Invoke("TestM"); }
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")); }
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")); }
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); }
public void AddEmptyMethodTest() { var c = new JScriptAssemblyCreator { ClassName = "TestClass" }; c.AddMethod("TestM", "public", null, null, ""); Assembly asm; c.Compile(out asm); Assert.IsNotNull(asm); }
public void InvalidMethodTest() { var c = new JScriptAssemblyCreator { ClassName = "TestClass" }; var i = c.Compile(); Assert.Throws<MissingMethodException>(() => i.Invoke("asdf")); }