示例#1
0
        public void CheckTemplateRootRelativeToInstallPath(string pathToTemplateJson, bool shouldAllPathsBeValid)
        {
            SimpleConfigModel        baseConfig = SimpleConfigModel.FromJObject(JObject.Parse(BasicTemplateConfig));
            RunnableProjectGenerator generator  = new RunnableProjectGenerator();

            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();

            IFile templateFile = setup.FileInfoForSourceFile(pathToTemplateJson);
            RunnableProjectConfig templateModel = new RunnableProjectConfig(_engineEnvironmentSettings, generator, baseConfig, templateFile);

            if (shouldAllPathsBeValid)
            {
                Assert.Empty(templateModel.ValidateTemplateSourcePaths());
            }
            else
            {
                Assert.NotEmpty(templateModel.ValidateTemplateSourcePaths());
            }
        }
示例#2
0
        public void CheckTemplateSourcesRelativeToTemplateRootMultipleDirsUnderMountPoint(bool shouldAllPathsBeValid, string source)
        {
            string                   templateConfig = string.Format(TemplateConfigWithSourcePlaceholder, source);
            SimpleConfigModel        baseConfig     = SimpleConfigModel.FromJObject(JObject.Parse(templateConfig));
            RunnableProjectGenerator generator      = new RunnableProjectGenerator();

            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>();

            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();

            IFile templateFile = setup.FileInfoForSourceFile(pathToTemplateConfig);
            RunnableProjectConfig templateModel = new RunnableProjectConfig(_engineEnvironmentSettings, generator, baseConfig, templateFile);

            if (shouldAllPathsBeValid)
            {
                Assert.Empty(templateModel.ValidateTemplateSourcePaths());
            }
            else
            {
                Assert.NotEmpty(templateModel.ValidateTemplateSourcePaths());
            }
        }