protected IExecutable InstantiateSystemUnderTest(ExecutionXml executionXml) { var factory = new ExecutionFactory(); var instance = factory.Instantiate(executionXml.BaseItem as IExecutableArgs); return(instance); }
// Executes the expression tree that is passed to it. internal static object Execute(Expression expression, bool isEnumerable, LinqToAzureInputs inputs) { // The expression must represent a query over the data source. if (!IsQueryOverDataSource(expression)) { throw new InvalidProgramException("No query over the data source was specified."); } // Find the call to Where() and get the lambda expression predicate. var factory = new ExecutionFactory(expression, inputs); var queryableStorageAccount = factory.GetConcreteQueryable(); // Copy the expression tree that was passed in, changing only the first // argument of the innermost MethodCallExpression. var treeCopier = new ExpressionTreeModifier(queryableStorageAccount); var newExpressionTree = treeCopier.Visit(expression); // This step creates an IQueryable that executes by replacing Queryable methods with Enumerable methods. return(isEnumerable ? queryableStorageAccount.Provider.CreateQuery(newExpressionTree) : queryableStorageAccount.Provider.Execute(newExpressionTree)); }
private void initializeLeechers() { if (_leechers == null) { _leechers = new List <LeecherBase>(); foreach (LeecherElement leecherConfiguration in AcroniManagerConfigurationSection.Instance.Leechers) { Type leecherType = ConfigurableBase.GetType(leecherConfiguration.Class, typeof(LeecherBase), "leecher"); Crawler crawler = CrawlerFactory.GetCrawler(leecherConfiguration); foreach (ExecutionElement executionConfiguration in leecherConfiguration.Executions) { ValidateConfiguration(executionConfiguration); LeecherBase leecher = ConfigurableBase.CreateConfigurableItem <LeecherBase>(leecherType, executionConfiguration.Parameters); leecher.Execution = ExecutionFactory.GetExecution(executionConfiguration, crawler); _leechers.Add(leecher); } } } }
public IActionResult Post([FromBody] SmartHomeRequest smartRequest) { if (Request.Headers.ContainsKey("Authorization")) { SmartHomeResponse resp = new SmartHomeResponse(); resp.requestId = smartRequest.requestId; resp.payload.agentUserId = "josh"; foreach (var intent in smartRequest.inputs) { if (intent.intent == "action.devices.SYNC") { resp.payload.devices = new List <Device>() { Utils.GetDevice() }; } else if (intent.intent == "action.devices.EXECUTE") { var commandInfo = intent.payload.commands.FirstOrDefault(); var executionInfo = commandInfo.execution.FirstOrDefault(); var commandsResponse = ExecutionFactory.Execute(commandInfo.devices.FirstOrDefault().id, executionInfo.command, executionInfo.parameters); resp.payload.commands = new List <CommandsResponse>() { commandsResponse }; } } return(Ok(resp)); } return(StatusCode(400)); }