コード例 #1
0
        public async void GenerateEmptyProject(string name, string framework, string projId)
        {
            var projectTemplate = GenerationTestsFixture.Templates.Where(t => t.Identity == projId).FirstOrDefault();
            var projectName     = $"{name}{framework}";

            using (var context = GenContext.CreateNew(projectName, Path.Combine(_fixture.TestProjectsPath, projectName, projectName)))
            {
                var userSelection = new UserSelection
                {
                    Framework   = framework,
                    ProjectType = projectTemplate.GetProjectType(),
                };

                AddLayoutItems(userSelection, projectTemplate);

                await GenController.UnsafeGenerateAsync(userSelection);

                //Build solution
                var outputPath = Path.Combine(_fixture.TestProjectsPath, projectName);
                var result     = BuildSolution(projectName, outputPath);

                //Assert
                Assert.True(result.exitCode.Equals(0), $"Solution {projectTemplate.Name} was not built successfully. {Environment.NewLine}Errors found: {GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details.");

                //Clean
                Directory.Delete(outputPath, true);
            }
        }
コード例 #2
0
        public async void GenerateAllPagesAndFeaturesRandomNames(string projectType, string framework)
        {
            var targetProjectTemplate = GenerationTestsFixture.Templates.FirstOrDefault(t => t.GetTemplateType() == TemplateType.Project && t.GetProjectTypeList().Contains(projectType) && t.GetFrameworkList().Contains(framework) && !t.GetIsHidden());
            var projectName           = $"{projectType}{framework}AllRandom";

            ProjectName = projectName;
            OutputPath  = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            var userSelection = new UserSelection
            {
                Framework   = framework,
                ProjectType = projectType,
                HomeName    = "Main"
            };

            AddLayoutItems(userSelection, targetProjectTemplate);
            AddItems(userSelection, GetTemplates(framework, TemplateType.Page), GetRandomName);
            AddItems(userSelection, GetTemplates(framework, TemplateType.Feature), GetRandomName);

            await GenController.UnsafeGenerateAsync(userSelection);

            //Build solution
            var outputPath = Path.Combine(_fixture.TestProjectsPath, projectName);
            var result     = BuildSolution(projectName, outputPath);

            //Assert
            Assert.True(result.exitCode.Equals(0), $"Solution {targetProjectTemplate.Name} was not built successfully. {Environment.NewLine}Errors found: {GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details.");

            //Clean
            Directory.Delete(outputPath, true);
        }
コード例 #3
0
        public async void GenerateEmptyProject(string projectType, string framework, string language)
        {
            SetupFixtureAndContext(language);

            var projectTemplate = _fixture.Templates
                                  .FirstOrDefault(t => t.GetTemplateType() == TemplateType.Project &&
                                                  t.GetProjectTypeList().Contains(projectType) &&
                                                  t.GetFrameworkList().Contains(framework));
            var projectName = $"{projectType}{framework}";

            ProjectName = projectName;
            OutputPath  = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            var userSelection = new UserSelection
            {
                Framework   = framework,
                ProjectType = projectType,
                HomeName    = "Main",
                Language    = language
            };

            AddLayoutItems(userSelection, projectTemplate);

            await GenController.UnsafeGenerateAsync(userSelection);

            //Build solution
            var outputPath = Path.Combine(_fixture.TestProjectsPath, projectName);
            var result     = BuildSolution(projectName, outputPath);

            //Assert
            Assert.True(result.exitCode.Equals(0), $"Solution {projectTemplate.Name} was not built successfully. {Environment.NewLine}Errors found: {GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details.");

            //Clean
            Directory.Delete(outputPath, true);
        }
コード例 #4
0
        public async void GenerateProjectWithIsolatedItems(string itemName, string projectType, string framework, string itemId, string language)
        {
            SetupFixtureAndContext(language);

            var projectTemplate = _fixture.Templates.FirstOrDefault(t => t.GetTemplateType() == TemplateType.Project && t.GetProjectTypeList().Contains(projectType) && t.GetFrameworkList().Contains(framework));
            var itemTemplate    = _fixture.Templates.FirstOrDefault(t => t.Identity == itemId);
            var finalName       = itemTemplate.GetDefaultName();
            var validators      = new List <Validator>()
            {
                new ReservedNamesValidator(),
            };

            if (itemTemplate.GetItemNameEditable())
            {
                validators.Add(new DefaultNamesValidator());
            }

            finalName = Naming.Infer(finalName, validators);
            var projectName = $"{projectType}{framework}{finalName}";

            ProjectName = projectName;
            OutputPath  = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            var userSelection = new UserSelection
            {
                Framework   = framework,
                ProjectType = projectType,
                HomeName    = "Main",
                Language    = language
            };

            AddLayoutItems(userSelection, projectTemplate);
            AddItem(userSelection, finalName, itemTemplate);

            await GenController.UnsafeGenerateAsync(userSelection);

            //Build solution
            var outputPath = Path.Combine(_fixture.TestProjectsPath, projectName);
            var result     = BuildSolution(projectName, outputPath);

            //Assert
            Assert.True(result.exitCode.Equals(0), $"Solution {projectTemplate.Name} was not built successfully. {Environment.NewLine}Errors found: {GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details.");

            //Clean
            Directory.Delete(outputPath, true);
        }
コード例 #5
0
        public async void GenerateProjectWithIsolatedItems(string itemName, string name, string framework, string projId, string itemId)
        {
            var projectTemplate = GenerationTestsFixture.Templates.Where(t => t.Identity == projId).FirstOrDefault();
            var itemTemplate    = GenerationTestsFixture.Templates.FirstOrDefault(t => t.Identity == itemId);
            var finalName       = itemTemplate.GetDefaultName();

            if (itemTemplate.GetItemNameEditable())
            {
                finalName = Naming.Infer(_usedNames, itemTemplate.GetDefaultName());
            }

            var projectName = $"{name}{framework}{finalName}";

            ProjectName = projectName;
            OutputPath  = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            var userSelection = new UserSelection
            {
                Framework   = framework,
                ProjectType = projectTemplate.GetProjectType(),
            };

            AddLayoutItems(userSelection, projectTemplate);
            AddItem(userSelection, finalName, itemTemplate);

            await GenController.UnsafeGenerateAsync(userSelection);

            //Build solution
            var outputPath = Path.Combine(_fixture.TestProjectsPath, projectName);
            var result     = BuildSolution(projectName, outputPath);

            //Assert
            Assert.True(result.exitCode.Equals(0), $"Solution {projectTemplate.Name} was not built successfully. {Environment.NewLine}Errors found: {GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details.");

            //Clean
            Directory.Delete(outputPath, true);
        }