static async Task CreateFromTemplateAndBuild(string basename, string templateId, string parameters, Action <Solution> preBuildChecks = null, bool checkExecutionTargets = false)
        {
            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(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");
                            }
                        }
                    }
                }
            }
        }
Example #2
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));
            }
        }
Example #3
0
        static string GetProjectTypeGuid(SolutionTemplate template)
        {
            string language = ProjectTemplateTest.GetLanguage(template.Id);

            if (language == "F#")
            {
                return("{F2A71F9B-5D33-465A-A702-920D77279786}");
            }

            if (language == "VBNet")
            {
                return("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}");
            }

            // C#
            return("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}");
        }