public FunctionInvokerBaseTests() { _metricsLogger = new TestMetricsLogger(); _testLoggerProvider = new TestLoggerProvider(); ILoggerFactory loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(_testLoggerProvider); var eventManager = new ScriptEventManager(); var metadata = new FunctionMetadata { Name = "TestFunction", ScriptFile = "index.js", Language = "node" }; JObject binding = JObject.FromObject(new { type = "manualTrigger", name = "manual", direction = "in" }); metadata.Bindings.Add(BindingMetadata.Create(binding)); var metadataManager = new MockMetadataManager(new[] { metadata }); _host = new HostBuilder() .ConfigureDefaultTestWebScriptHost() .ConfigureServices(s => { s.AddSingleton <IFunctionMetadataManager>(metadataManager); }) .Build(); _scriptHost = _host.GetScriptHost(); _scriptHost.InitializeAsync().Wait(); _invoker = new MockInvoker(_scriptHost, _metricsLogger, metadataManager, metadata, loggerFactory); }
public void MultipleTriggers_Succeeds() { BindingMetadata bindingMetadata1 = new BindingMetadata { Type = "ATrigger", Raw = JObject.FromObject(new { key0 = "foo" }) }; BindingMetadata bindingMetadata2 = new BindingMetadata { Type = "BTrigger", Raw = JObject.FromObject(new { key0 = "bar" }) }; FunctionMetadata functionMetadata = new FunctionMetadata { Name = "test" }; functionMetadata.Bindings.Add(bindingMetadata1); functionMetadata.Bindings.Add(bindingMetadata2); ICollection <FunctionMetadata> metadata = new Collection <FunctionMetadata> { functionMetadata }; var metadataManager = new MockMetadataManager(metadata); var config = _configBuilder.Build(); var validator = new ExternalConfigurationStartupValidator(config, metadataManager); var invalidValues = validator.Validate(config); Assert.Empty(invalidValues); }