Beispiel #1
0
        static async Task CreateFromTemplateAndBuild(string basename, string templateId, string parameters, Action <Solution> preBuildChecks = null, bool checkExecutionTargets = false)
        {
            using (var ptt = new DotNetCoreProjectTemplateTest(basename, templateId)) {
                foreach (var templateParameter in TemplateParameter.CreateParameters(parameters))
                {
                    ptt.Config.Parameters [templateParameter.Name] = templateParameter.Value;
                }

                var template = await ptt.CreateAndBuild(preBuildChecks);

                CheckProjectTypeGuids(ptt.Solution, GetProjectTypeGuid(template));
                // Blacklist library projects, which don't get any execution target
                if (checkExecutionTargets)
                {
                    foreach (var p in ptt.Solution.GetAllProjects().OfType <DotNetProject> ())
                    {
                        foreach (var config in p.Configurations)
                        {
                            var targets = p.GetExecutionTargets(config.Selector)?.ToList() ?? new List <ExecutionTarget> ();
                            if (System.IO.Directory.Exists("/Applications/Safari.app"))
                            {
                                Assert.True(targets.Any(x => x.Name.Contains("Safari")), $"Configuration {config.Name} didn't contain Safari");
                            }
                            if (System.IO.Directory.Exists("/Applications/Google Chrome.app"))
                            {
                                Assert.True(targets.Any(x => x.Name.Contains("Google Chrome")), $"Configuration {config.Name} didn't contain Chrome");
                            }
                        }
                    }
                }
            }
        }
        NewProjectConfiguration CreateNewProjectConfig(string baseName, string templateId, string parameters)
        {
            FilePath solutionDirectory = Util.CreateTmpDir(baseName);

            CreateNuGetConfigFile(solutionDirectory);

            string projectName = GetProjectName(templateId);

            var config = new NewProjectConfiguration {
                CreateSolution = true,
                CreateProjectDirectoryInsideSolutionDirectory = true,
                CreateGitIgnoreFile = false,
                UseGit       = false,
                Location     = solutionDirectory,
                ProjectName  = projectName,
                SolutionName = projectName
            };

            foreach (var templateParameter in TemplateParameter.CreateParameters(parameters))
            {
                config.Parameters [templateParameter.Name] = templateParameter.Value;
            }

            Directory.CreateDirectory(config.ProjectLocation);

            return(config);
        }
Beispiel #3
0
        static async Task CreateFromTemplateAndBuild(string basename, string templateId, string parameters)
        {
            using (var ptt = new ProjectTemplateTest(basename, templateId)) {
                foreach (var templateParameter in TemplateParameter.CreateParameters(parameters))
                {
                    ptt.Config.Parameters [templateParameter.Name] = templateParameter.Value;
                }

                var template = await ptt.CreateAndBuild();

                CheckProjectTypeGuids(ptt.Solution, GetProjectTypeGuid(template));
            }
        }