public FunctionDescriptorProviderTests()
 {
     string rootPath = Path.Combine(Environment.CurrentDirectory, @"TestScripts\Node");
     ScriptHostConfiguration config = new ScriptHostConfiguration
     {
         RootScriptPath = rootPath
     };
     _settingsManager = ScriptSettingsManager.Instance;
     _host = ScriptHost.Create(_settingsManager, config);
     _provider = new TestDescriptorProvider(_host, config);
 }
        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> functions = new List<FunctionMetadata>();
            functions.Add(metadata);

            ScriptHostConfiguration scriptConfig = new ScriptHostConfiguration()
            {
                RootScriptPath = rootPath
            };

            Collection<FunctionDescriptor> functionDescriptors = null;
            using (ScriptHost host = ScriptHost.Create(SettingsManager, scriptConfig))
            {
                FunctionDescriptorProvider[] descriptorProviders = new FunctionDescriptorProvider[]
                {
                new NodeFunctionDescriptorProvider(host, scriptConfig)
                };

                functionDescriptors = host.ReadFunctions(functions, descriptorProviders);
            }

            Type t = FunctionGenerator.Generate("TestScriptHost", "Host.Functions", null, functionDescriptors);

            MethodInfo method = t.GetMethods(BindingFlags.Public | BindingFlags.Static).First();
            return method;
        }
        private static MethodInfo GenerateMethod(BindingMetadata trigger, ScriptHostInfo scriptHostInfo)
        {
            FunctionMetadata metadata = new FunctionMetadata();
            metadata.Name = FunctionName;
            metadata.ScriptFile = Path.Combine(scriptHostInfo.RootPath, @"Common\test.ps1");
            metadata.Bindings.Add(trigger);
            metadata.ScriptType = ScriptType.PowerShell;

            List<FunctionMetadata> functions = new List<FunctionMetadata>();
            functions.Add(metadata);
            FunctionDescriptorProvider[] descriptorProviders = new FunctionDescriptorProvider[]
            {
                new PowerShellFunctionDescriptorProvider(scriptHostInfo.Host, scriptHostInfo.Configuration)
            };

            var functionDescriptors = scriptHostInfo.Host.ReadFunctions(functions, descriptorProviders);
            Type t = FunctionGenerator.Generate("TestScriptHost", "Host.Functions", null, functionDescriptors);

            MethodInfo method = t.GetMethods(BindingFlags.Public | BindingFlags.Static).First();
            return method;
        }