public void CheckTemplateSourcesRelativeToTemplateRootMultipleDirsUnderMountPoint(bool shouldAllPathsBeValid, string source) { const string pathFromMountPointRootToTemplateRoot = "MountRoot/Stuff/TemplateRoot/"; string pathToTemplateConfig = pathFromMountPointRootToTemplateRoot + ".template.config/template.json"; string sourcePath = FileSystemHelpers.GetNewVirtualizedPath(EngineEnvironmentSettings); IDictionary <string, string> templateSourceFiles = new Dictionary <string, string>(); string templateConfig = String.Format(TemplateConfigWithSourcePlaceholder, source); templateSourceFiles.Add(pathToTemplateConfig, templateConfig); string sampleContentDir = pathFromMountPointRootToTemplateRoot + "things/stuff/_._"; templateSourceFiles.Add(sampleContentDir, ""); // directories under the template root - valid source locations. templateSourceFiles.Add("ExistingDir/_._", ""); templateSourceFiles.Add("MountRoot/Subdir/_._", ""); TestTemplateSetup setup = new TestTemplateSetup(EngineEnvironmentSettings, sourcePath, templateSourceFiles); setup.WriteSource(); RunnableProjectGenerator generator = new RunnableProjectGenerator(); IFile templateFile = setup.FileInfoForSourceFile(pathToTemplateConfig); JObject srcObject = generator.ReadJObjectFromIFile(templateFile); SimpleConfigModel templateModel = SimpleConfigModel.FromJObject(templateFile.MountPoint.EnvironmentSettings, srcObject); RunnableProjectTemplate runnableProjectTemplate = new RunnableProjectTemplate(srcObject, generator, templateFile, templateModel, null, null); bool allPathsAreValid = generator.AreAllTemplatePathsValid(templateModel, runnableProjectTemplate); Assert.Equal(shouldAllPathsBeValid, allPathsAreValid); }
public void CheckTemplateRootRelativeToInstallPath(string pathToTemplateJson, bool shouldAllPathsBeValid) { string sourcePath = FileSystemHelpers.GetNewVirtualizedPath(EngineEnvironmentSettings); IDictionary <string, string> templateSourceFiles = new Dictionary <string, string>(); templateSourceFiles.Add(pathToTemplateJson, BasicTemplateConfig); TestTemplateSetup setup = new TestTemplateSetup(EngineEnvironmentSettings, sourcePath, templateSourceFiles); setup.WriteSource(); RunnableProjectGenerator generator = new RunnableProjectGenerator(); IFile templateFile = setup.FileInfoForSourceFile(pathToTemplateJson); JObject srcObject = generator.ReadJObjectFromIFile(templateFile); SimpleConfigModel templateModel = SimpleConfigModel.FromJObject(templateFile.MountPoint.EnvironmentSettings, srcObject); RunnableProjectTemplate runnableProjectTemplate = new RunnableProjectTemplate(srcObject, generator, templateFile, templateModel, null, null); bool allPathsAreValid = generator.AreAllTemplatePathsValid(templateModel, runnableProjectTemplate); Assert.Equal(shouldAllPathsBeValid, allPathsAreValid); }