public static string GenerateAppProject(UnifiedTestConfig config)
        {
            ProjectLanguage language = config.FSharp ? ProjectLanguage.FSharp : ProjectLanguage.CSharp;
            ProjectFlavor   flavor   = config.XM45 ? ProjectFlavor.FullXM : ProjectFlavor.ModernXM;

            TemplateInfo info;

            if (!string.IsNullOrEmpty(config.ProjectName))
            {
                info = TemplateInfo.FromCustomProject(ProjectType.App, language, config.ProjectName);
            }
            else
            {
                info = new TemplateInfo(flavor, ProjectType.App, language);
                config.ProjectName = info.ProjectName;
            }

            var engine            = new MacAppTemplateEngine(info);
            var fileSubstitutions = new FileSubstitutions {
                TestCode = config.TestCode,
                TestDecl = config.TestDecl,
            };
            PListSubstitutions pListSubstitutions = new PListSubstitutions()
            {
                Replacements = config.PlistReplaceStrings
            };

            return(engine.Generate(config.TmpDir, CreateDefaultSubstitutions(config), fileSubstitutions, pListSubstitutions));
        }
예제 #2
0
        public void MacTestApp()
        {
            var tmpDir = Cache.CreateTemporaryDirectory();

            var engine            = new MacAppTemplateEngine(ProjectFlavor.FullXM, ProjectLanguage.CSharp);
            var fileSubstitutions = new FileSubstitutions {
                TestCode = "System.Console.WriteLine (typeof (int));"
            };
            var projectSubstitutions = new ProjectSubstitutions {
                References = "<Reference Include=\"System.Net.Http\" />",
            };
            string projectPath = engine.Generate(tmpDir, projectSubstitutions, fileSubstitutions);

            ProjectBuilder.BuildProject(projectPath, "/");              /* Use system XM instead of _mac-build today */
        }