public void InstantiateTemplate(string targetBaseDir, IParameterSet parameters = null, IVariableCollection variables = null) { if (parameters == null) { parameters = new MockParameterSet(); } if (variables == null) { variables = new VariableCollection(); } IRunnableProjectConfig runnableConfig = TemplateConfigTestHelpers.ConfigFromSource(_environment, SourceMountPoint); IFileSystemInfo configFileInfo = TemplateConfigTestHelpers.ConfigFileSystemInfo(SourceMountPoint, _configFile); runnableConfig.Evaluate(parameters, variables, configFileInfo); MockGlobalRunSpec runSpec = new MockGlobalRunSpec(); runSpec.RootVariableCollection = variables; IDirectory sourceDir = SourceMountPoint.DirectoryInfo("/"); IOrchestrator2 basicOrchestrator = new Core.Util.Orchestrator(); RunnableProjectOrchestrator orchestrator = new RunnableProjectOrchestrator(basicOrchestrator); foreach (FileSourceMatchInfo source in runnableConfig.Sources) { TemplateConfigTestHelpers.SetupFileSourceMatchersOnGlobalRunSpec(runSpec, source); string targetDirForSource = Path.Combine(targetBaseDir, source.Target); orchestrator.Run(runSpec, sourceDir, targetDirForSource); } }
public IReadOnlyDictionary <string, IReadOnlyList <IFileChange2> > GetFileChanges(string targetBaseDir, IParameterSet parameters = null, IVariableCollection variables = null) { if (parameters == null) { parameters = new MockParameterSet(); } if (variables == null) { variables = new VariableCollection(); } IRunnableProjectConfig runnableConfig = TemplateConfigTestHelpers.ConfigFromSource(_environment, SourceMountPoint); IFileSystemInfo configFileInfo = TemplateConfigTestHelpers.ConfigFileSystemInfo(SourceMountPoint, _configFile); runnableConfig.Evaluate(parameters, variables, configFileInfo); MockGlobalRunSpec runSpec = new MockGlobalRunSpec(); IDirectory sourceDir = SourceMountPoint.DirectoryInfo("/"); IOrchestrator2 basicOrchestrator = new Core.Util.Orchestrator(); RunnableProjectOrchestrator orchestrator = new RunnableProjectOrchestrator(basicOrchestrator); Dictionary <string, IReadOnlyList <IFileChange2> > changesByTarget = new Dictionary <string, IReadOnlyList <IFileChange2> >(); foreach (FileSourceMatchInfo source in runnableConfig.Sources) { TemplateConfigTestHelpers.SetupFileSourceMatchersOnGlobalRunSpec(runSpec, source); string targetDirForSource = Path.Combine(targetBaseDir, source.Target); IReadOnlyList <IFileChange2> changes = orchestrator.GetFileChanges(runSpec, sourceDir, targetDirForSource); changesByTarget[source.Target] = changes; } return(changesByTarget); }