public void CanCompileASimpleScript() { var compiler = new CSharpScriptCompiler(); var script = compiler.CompileScript("throw new Exception(\"Test\")"); Assert.Throws<Exception>(() => script.Run(), "Test"); }
public void CanDelegatedAClassWithAProperty() { // Arrange var compiler = new CSharpScriptCompiler(); var script = compiler.CompileScript(string.Empty, typeof(TestScriptPropertyEnvironment)); // Act script.Run(new TestScriptPropertyEnvironment()); }
public void CanCallAMethodInADelegatedClass() { // Arrange var compiler = new CSharpScriptCompiler(); var script = compiler.CompileScript("AbortIf(true)", typeof(TestScriptPropertyEnvironment)); // Act var environment = new TestScriptPropertyEnvironment(); script.Run(environment); // Assert environment.Abort.ShouldBeTrue(); }
public void ShowCode() { var scriptCompiler = new CSharpScriptCompiler(); Console.WriteLine(scriptCompiler.ShowGeneratedCode("DoIt()", typeof(HelloWorldEnvironment))); }