Exemplo n.º 1
0
        public void CreateSolutionTemplateTest()
        {
            ITemplateRepository templateRepository = new TemplateRepository();

            var solution          = SolutionFileParser.ParseSolutionFile(_testSolutionFile);
            var solutionFileItems = solution.GetSortedHierarchy();
            var projectTemplates  = new List <IProjectTemplate>();

            var solutionTemplate = new ProjectTemplate(true)
            {
                TemplateName    = "TestSolutionTemplate",
                Description     = "DEscr",
                LanguageTag     = "C#",
                CreateNewFolder = true
            };

            foreach (var solutionItem in solutionFileItems)
            {
                projectTemplates.Add(templateRepository.ReadProjectTemplate(Path.GetDirectoryName(_testSolutionFile), solutionItem, solutionTemplate));
            }

            var solutionTemplateFileName = Path.Combine(_outputDir, "solution.vstemplate");

            templateRepository.CreateSolutionTemplate(solutionTemplateFileName, solutionTemplate, projectTemplates);
        }
Exemplo n.º 2
0
        public void ParseSolutionTest()
        {
            var solution      = SolutionFileParser.ParseSolutionFile(_testSolutionFile);
            var solutionItems = solution.GetSortedHierarchy();

            Assert.AreEqual(17, solution.Count);
            Assert.AreEqual(4, solutionItems.Count);

            Assert.AreEqual(0, solutionItems[0].Children.Count);
            Assert.AreEqual(4, solutionItems[1].Children.Count);
            Assert.AreEqual(2, solutionItems[2].Children.Count);
            Assert.AreEqual(4, solutionItems[3].Children.Count);

            Assert.AreEqual(1, solutionItems[1].Children[1].Children.Count);
            Assert.AreEqual(2, solutionItems[1].Children[2].Children.Count);
        }
Exemplo n.º 3
0
        private List <SolutionProjectItem> GetSolutionFileItems(string solutionFile)
        {
            var solution = SolutionFileParser.ParseSolutionFile(solutionFile);

            return(solution.GetSortedHierarchy());
        }