public async void GenerateAllPagesAndFeaturesRandomNames(string projectType, string framework) { var targetProjectTemplate = GenerationFixture.Templates.FirstOrDefault(t => t.GetTemplateType() == TemplateType.Project && t.GetProjectTypeList().Contains(projectType) && t.GetFrameworkList().Contains(framework) && !t.GetIsHidden()); var projectName = $"{projectType}{framework}AllRandom"; ProjectName = projectName; ProjectPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName); OutputPath = ProjectPath; var userSelection = GenerationFixture.SetupProject(projectType, framework); GenerationFixture.AddItems(userSelection, GenerationFixture.GetTemplates(framework), GenerationFixture.GetRandomName); await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection); //Build solution var outputPath = Path.Combine(_fixture.TestProjectsPath, projectName); var result = GenerationFixture.BuildSolution(projectName, outputPath); //Assert Assert.True(result.exitCode.Equals(0), $"Solution {targetProjectTemplate.Name} was not built successfully. {Environment.NewLine}Errors found: {GenerationFixture.GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details."); //Clean Directory.Delete(outputPath, true); }
protected async Task <string> AssertGenerateProjectAsync(Func <ITemplateInfo, bool> projectTemplateSelector, string projectName, string projectType, string framework, string language, Func <ITemplateInfo, string> getName = null, bool cleanGeneration = true) { await SetUpFixtureForTestingAsync(language); var targetProjectTemplate = GenerationFixture.Templates.FirstOrDefault(projectTemplateSelector); ProjectName = projectName; ProjectPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName); OutputPath = ProjectPath; var userSelection = await GenerationFixture.SetupProjectAsync(projectType, framework, language); if (getName != null) { GenerationFixture.AddItems(userSelection, GenerationFixture.GetTemplates(framework), getName); } await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection); var resultPath = Path.Combine(_fixture.TestProjectsPath, projectName); // Assert Assert.True(Directory.Exists(resultPath)); Assert.True(Directory.GetFiles(resultPath, "*.*", SearchOption.AllDirectories).Count() > 2); // Clean if (cleanGeneration) { Fs.SafeDeleteDirectory(resultPath); } return(resultPath); }
public static IEnumerable <object[]> GetPageAndFeatureTemplatesForGenerationAsync(string framework) { JoinableTaskContext context = new JoinableTaskContext(); JoinableTaskCollection tasks = context.CreateCollection(); context.CreateFactory(tasks); var result = context.Factory.Run(() => GenerationFixture.GetPageAndFeatureTemplatesAsync(framework)); return(result); }
public static IEnumerable <object[]> GetProjectTemplatesAsync() { JoinableTaskContext context = new JoinableTaskContext(); JoinableTaskCollection tasks = context.CreateCollection(); context.CreateFactory(tasks); var result = context.Factory.Run(() => GenerationFixture.GetProjectTemplatesAsync()); return(result); }
protected void AssertBuildProjectAsync(string projectPath, string projectName) { // Build solution var result = GenerationFixture.BuildSolution(projectName, projectPath); // Assert Assert.True(result.exitCode.Equals(0), $"Solution {projectName} was not built successfully. {Environment.NewLine}Errors found: {GenerationFixture.GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details."); // Clean Fs.SafeDeleteDirectory(projectPath); }
public static IEnumerable <object[]> GetCSharpUwpProjectTemplatesForGeneration() { var result = GenerationFixture.GetProjectTemplates(); foreach (var item in result) { if (item[2].ToString() == Platforms.Uwp && item[3].ToString() == ProgrammingLanguages.CSharp) { yield return(item); } } }
public async void GenerateEmptyProject(string projectType, string framework) { var projectName = $"{projectType}{framework}"; ProjectName = projectName; ProjectPath = Path.Combine(_fixture.TestNewItemPath, projectName, projectName); OutputPath = ProjectPath; var userSelection = GenerationFixture.SetupProject(projectType, framework); await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection); //Add new item var rightClickTemplates = GenerationFixture.Templates.Where (t => (t.GetTemplateType() == TemplateType.Feature || t.GetTemplateType() == TemplateType.Page) && t.GetFrameworkList().Contains(framework) && (!t.GetIsHidden()) && t.GetRightClickEnabled()); foreach (var item in rightClickTemplates) { OutputPath = GetTempGenerationPath(projectName); var newUserSelection = new UserSelection() { ProjectType = projectType, Framework = framework, HomeName = "", ItemGenerationType = ItemGenerationType.GenerateAndMerge }; GenerationFixture.AddItem(newUserSelection, item, GenerationFixture.GetDefaultName); await NewItemGenController.Instance.UnsafeGenerateNewItemAsync(item.GetTemplateType(), newUserSelection); NewItemGenController.Instance.UnsafeFinishGeneration(newUserSelection); } //Build solution var outputPath = Path.Combine(_fixture.TestNewItemPath, projectName); var result = GenerationFixture.BuildSolution(projectName, outputPath); //Assert Assert.True(result.exitCode.Equals(0), $"Solution {projectName} was not built successfully. {Environment.NewLine}Errors found: {GenerationFixture.GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details."); //Clean Directory.Delete(outputPath, true); }
protected async Task <(string ProjectPath, string ProjecName)> AssertGenerationOneByOneAsync(string itemName, string projectType, string framework, string itemId, string language, bool cleanGeneration = true) { await SetUpFixtureForTestingAsync(language); var projectTemplate = GenerationFixture.Templates.FirstOrDefault(t => t.GetTemplateType() == TemplateType.Project && t.GetProjectTypeList().Contains(projectType) && t.GetFrameworkList().Contains(framework)); var itemTemplate = GenerationFixture.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; ProjectPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName); OutputPath = ProjectPath; var userSelection = await GenerationFixture.SetupProjectAsync(projectType, framework, language); GenerationFixture.AddItem(userSelection, itemTemplate, GenerationFixture.GetDefaultName); await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection); var resultPath = Path.Combine(_fixture.TestProjectsPath, projectName); // Assert Assert.True(Directory.Exists(resultPath)); Assert.True(Directory.GetFiles(resultPath, "*.*", SearchOption.AllDirectories).Count() > 2); // Clean if (cleanGeneration) { Fs.SafeDeleteDirectory(resultPath); } return(resultPath, projectName); }
public async void GenerateProjectWithIsolatedItems(string itemName, string projectType, string framework, string itemId) { var projectTemplate = GenerationFixture.Templates.FirstOrDefault(t => t.GetTemplateType() == TemplateType.Project && t.GetProjectTypeList().Contains(projectType) && t.GetFrameworkList().Contains(framework)); var itemTemplate = GenerationFixture.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; ProjectPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName); OutputPath = ProjectPath; var userSelection = GenerationFixture.SetupProject(projectType, framework); GenerationFixture.AddItem(userSelection, itemTemplate, GenerationFixture.GetDefaultName); await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection); //Build solution var outputPath = Path.Combine(_fixture.TestProjectsPath, projectName); var result = GenerationFixture.BuildSolution(projectName, outputPath); //Assert Assert.True(result.exitCode.Equals(0), $"Solution {projectTemplate.Name} was not built successfully. {Environment.NewLine}Errors found: {GenerationFixture.GetErrorLines(result.outputFile)}.{Environment.NewLine}Please see {Path.GetFullPath(result.outputFile)} for more details."); //Clean Directory.Delete(outputPath, true); }
public VisualComparisonTests(GenerationFixture fixture) { _fixture = fixture; _fixture.InitializeFixtureAsync(this); }
public LanguageComparisonTests(GenerationFixture fixture) : base(fixture) { }
public GenProjectTests(GenerationFixture fixture) { _fixture = fixture; _fixture.InitializeFixtureAsync(this); }
public ResourceUsageTests(GenerationFixture fixture) : base(fixture) { }
public BuildProjectTests(GenerationFixture fixture) { _fixture = fixture; }
public static IEnumerable <object[]> GetProjectTemplatesForGenerationAsync() { var result = GenerationFixture.GetProjectTemplates(); return(result); }
public LanguageComparisonTests(GenerationFixture fixture) { _fixture = fixture; }
public static IEnumerable <object[]> GetPageAndFeatureTemplatesForGeneration(string framework) { var result = GenerationFixture.GetPageAndFeatureTemplatesForGeneration(framework); return(result); }
public ResourceUsageTests(GenerationFixture fixture) { _fixture = fixture; _fixture.InitializeFixture(this); }
public LanguageComparisonTests(GenerationFixture fixture) { _fixture = fixture; _fixture.InitializeFixture(this); }
public VisualComparisonTests(GenerationFixture fixture) : base(fixture) { }
public static IEnumerable <object[]> GetProjectTemplatesForGeneration() { return(GenerationFixture.GetProjectTemplates()); }
public ProjectGenerationTests(GenerationFixture fixture) { _fixture = fixture; GenContext.Bootstrap(new LocalTemplatesSource(), new FakeGenShell()); GenContext.Current = this; }
public AccessibilityTests(GenerationFixture fixture) : base(fixture) { }
protected async Task <string> AssertGenerateRightClickAsync(string projectName, string projectType, string framework, string language, bool cleanGeneration = true) { await SetUpFixtureForTestingAsync(language); ProjectName = projectName; ProjectPath = Path.Combine(_fixture.TestNewItemPath, projectName, projectName); OutputPath = ProjectPath; var userSelection = await GenerationFixture.SetupProjectAsync(projectType, framework, language); await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection); var emptyProject = Path.Combine(_fixture.TestNewItemPath, projectName); // Assert on project Assert.True(Directory.Exists(emptyProject)); int emptyProjecFileCount = Directory.GetFiles(emptyProject, "*.*", SearchOption.AllDirectories).Count(); Assert.True(emptyProjecFileCount > 2); // Add new items var rightClickTemplates = GenerationFixture.Templates.Where( t => (t.GetTemplateType() == TemplateType.Feature || t.GetTemplateType() == TemplateType.Page) && t.GetFrameworkList().Contains(framework) && !t.GetIsHidden() && t.GetRightClickEnabled()); foreach (var item in rightClickTemplates) { OutputPath = GenContext.GetTempGenerationPath(projectName); var newUserSelection = new UserSelection { ProjectType = projectType, Framework = framework, HomeName = "", Language = language, ItemGenerationType = ItemGenerationType.GenerateAndMerge }; GenerationFixture.AddItem(newUserSelection, item, GenerationFixture.GetDefaultName); await NewItemGenController.Instance.UnsafeGenerateNewItemAsync(item.GetTemplateType(), newUserSelection); NewItemGenController.Instance.UnsafeFinishGeneration(newUserSelection); } var finalProjectPath = Path.Combine(_fixture.TestNewItemPath, projectName); int finalProjectFileCount = Directory.GetFiles(finalProjectPath, "*.*", SearchOption.AllDirectories).Count(); Assert.True(finalProjectFileCount > emptyProjecFileCount); // Clean if (cleanGeneration) { Fs.SafeDeleteDirectory(finalProjectPath); } return(finalProjectPath); }
public static IEnumerable <object[]> GetPageAndFeatureTemplates() { return(GenerationFixture.GetPageAndFeatureTemplates()); }