private static MethodInfo GenerateMethod(BindingMetadata trigger) { string rootPath = Path.Combine(Environment.CurrentDirectory, @"TestScripts\Node"); FunctionMetadata metadata = new FunctionMetadata(); metadata.Name = "Test"; metadata.ScriptFile = Path.Combine(rootPath, @"Common\test.js"); metadata.Bindings.Add(trigger); List <FunctionMetadata> metadatas = new List <FunctionMetadata>(); metadatas.Add(metadata); ScriptHostConfiguration scriptConfig = new ScriptHostConfiguration() { RootScriptPath = rootPath }; ScriptHost host = ScriptHost.Create(scriptConfig); FunctionDescriptorProvider[] descriptorProviders = new FunctionDescriptorProvider[] { new NodeFunctionDescriptorProvider(host, scriptConfig) }; var functionDescriptors = host.ReadFunctions(metadatas, descriptorProviders); Type t = FunctionGenerator.Generate("TestScriptHost", "Host.Functions", functionDescriptors); MethodInfo method = t.GetMethods(BindingFlags.Public | BindingFlags.Static).First(); return(method); }