Example #1
0
        private async Task EnsureProjectsGeneratedWithDifferentLanguagesAreEquivalentAsync(string projectType, string framework, List <string> excludedTemplates)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(ProgrammingLanguages.CSharp);
            BaseGenAndBuildFixture.SetCurrentPlatform(Platforms.Uwp);

            var genIdentities = GetAllItemTemplateIdentites(projectType, framework, excludedTemplates);

            foreach (var csOnly in GetTemplatesThatDoNotSupportVB())
            {
                genIdentities.Remove(csOnly);
            }

            var(csResultPath, csProjectName) = await SetUpComparisonProjectAsync(ProgrammingLanguages.CSharp, projectType, framework, genIdentities);

            var(vbResultPath, vbProjectName) = await SetUpComparisonProjectAsync(ProgrammingLanguages.VisualBasic, projectType, framework, genIdentities);

            EnsureAllEquivalentFileNamesAreUsed(csResultPath, vbResultPath);
            EnsureResourceStringsAreIdenticalAndAllUsed(csResultPath, csProjectName, vbResultPath, vbProjectName);
            EnsureContentsOfAssetsFolderIsIdentical(csResultPath, csProjectName, vbResultPath, vbProjectName);
            EnsureContentsOfStylesFolderIsIdentical(csResultPath, csProjectName, vbResultPath, vbProjectName);
            EnsureFileCommentsAreIdentical(vbResultPath);
            EnsureCodeFilesContainIdenticalElements(vbResultPath);
            EnsureEquivalentErrorHandling(vbResultPath);

            Fs.SafeDeleteDirectory(csResultPath);
            Fs.SafeDeleteDirectory(vbResultPath);
        }
        protected async Task <(string ProjectPath, string ProjectName)> SetUpComparisonProjectAsync(string language, string projectType, string framework, IEnumerable <string> genIdentities, bool lastPageIsHome = false, bool includeMultipleInstances = true)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(language);
            BaseGenAndBuildFixture.SetCurrentPlatform(Platforms.Uwp);

            var singlePageName = string.Empty;

            var genIdentitiesList = genIdentities.ToList();

            if (genIdentitiesList.Count == 1)
            {
                singlePageName = genIdentitiesList.Last().Split('.').Last();
            }

            var projectName     = $"{projectType}{framework}{singlePageName}{ShortLanguageName(language)}";
            var destinationPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = destinationPath,
                GenerationOutputPath = destinationPath,
            };

            var userSelection = _fixture.SetupProject(projectType, framework, Platforms.Uwp, language);

            foreach (var identity in genIdentitiesList)
            {
                var itemTemplate = _fixture.Templates().FirstOrDefault(t
                                                                       => (t.Identity.StartsWith($"{identity}.") || t.Identity.Equals(identity)) &&
                                                                       (t.GetProjectTypeList().Contains(projectType) || t.GetProjectTypeList().Contains(All)) &&
                                                                       t.GetFrontEndFrameworkList().Contains(framework));

                var templateInfo = GenContext.ToolBox.Repo.GetTemplateInfo(itemTemplate, Platforms.Uwp, projectType, framework, _emptyBackendFramework);
                _fixture.AddItem(userSelection, templateInfo, BaseGenAndBuildFixture.GetDefaultName);

                // Add multiple pages if supported to check these are handled the same
                if (includeMultipleInstances && templateInfo.MultipleInstance)
                {
                    _fixture.AddItem(userSelection, templateInfo, BaseGenAndBuildFixture.GetDefaultName);
                }
            }

            if (lastPageIsHome)
            {
                // Useful if creating a blank project type and want to change the start page
                userSelection.HomeName = userSelection.Pages.Last().Name;

                if (projectType == "TabbedNav")
                {
                    userSelection.Pages.Reverse();
                }
            }

            await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection);

            var resultPath = Path.Combine(_fixture.TestProjectsPath, GenContext.Current.ProjectName);

            return(resultPath, GenContext.Current.ProjectName);
        }
        protected async Task <string> AssertGenerateRightClickAsync(string projectName, string projectType, string framework, string platform, string language, bool emptyProject, bool cleanGeneration = true)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(language);
            BaseGenAndBuildFixture.SetCurrentPlatform(platform);
            var path = Path.Combine(_fixture.TestNewItemPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = path,
                GenerationOutputPath = path,
            };

            var userSelection = _fixture.SetupProject(projectType, framework, platform, language);

            if (!emptyProject)
            {
                _fixture.AddItems(userSelection, _fixture.GetTemplates(framework, platform), BaseGenAndBuildFixture.GetDefaultName);
            }

            await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection);

            var project = Path.Combine(_fixture.TestNewItemPath, projectName);

            // Assert on project
            Assert.True(Directory.Exists(project));

            int emptyProjecFileCount = Directory.GetFiles(project, "*.*", SearchOption.AllDirectories).Count();

            Assert.True(emptyProjecFileCount > 2);

            var rightClickTemplates = _fixture.Templates().Where(
                t => (t.GetTemplateType() == TemplateType.Feature || t.GetTemplateType() == TemplateType.Page) &&
                t.GetFrameworkList().Contains(framework) &&
                t.GetPlatform() == platform &&
                !t.GetIsHidden() &&
                t.GetRightClickEnabled());

            await AddRightClickTemplatesAsync(path, rightClickTemplates, projectName, projectType, framework, platform, language);

            var finalProjectPath      = Path.Combine(_fixture.TestNewItemPath, projectName);
            int finalProjectFileCount = Directory.GetFiles(finalProjectPath, "*.*", SearchOption.AllDirectories).Count();

            if (emptyProject)
            {
                Assert.True(finalProjectFileCount > emptyProjecFileCount);
            }
            else
            {
                Assert.True(finalProjectFileCount == emptyProjecFileCount);
            }

            // Clean
            if (cleanGeneration)
            {
                Fs.SafeDeleteDirectory(finalProjectPath);
            }

            return(finalProjectPath);
        }
Example #4
0
        private async Task <string> GenerateProjectForTestingAsync(string projectName, string projectType, string framework, string platform, string language)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(language);
            BaseGenAndBuildFixture.SetCurrentPlatform(platform);

            // To initialize the list correctly
            var projectTemplate = _fixture.Templates().FirstOrDefault(t =>
                                                                      t.GetTemplateType() == TemplateType.Project &&
                                                                      t.GetProjectTypeList().Contains(projectType) &&
                                                                      t.GetFrameworkList().Contains(framework));

            var destinationPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = destinationPath,
                GenerationOutputPath = destinationPath,
            };

            var userSelection = _fixture.SetupProject(projectType, framework, platform, language);

            var itemTemplates = _fixture.Templates().Where(t => (t.GetTemplateType() == TemplateType.Page || t.GetTemplateType() == TemplateType.Feature) &&
                                                           t.GetFrameworkList().Contains(framework) &&
                                                           t.GetPlatform() == platform &&
                                                           !t.GetIsHidden());

            _fixture.AddItems(userSelection, itemTemplates, BaseGenAndBuildFixture.GetDefaultName);

            await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection);

            var resultPath = Path.Combine(_fixture.TestProjectsPath, projectName);

            return(resultPath);
        }
        protected async Task <(string ProjectPath, string ProjectName)> SetUpComparisonProjectAsync(string language, string projectType, string framework, IEnumerable <string> genIdentities, bool lastPageIsHome = false)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(language);
            BaseGenAndBuildFixture.SetCurrentPlatform(Platforms.Uwp);

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

            var singlePageName = string.Empty;

            var genIdentitiesList = genIdentities.ToList();

            if (genIdentitiesList.Count == 1)
            {
                singlePageName = genIdentitiesList.Last().Split('.').Last();
            }

            ProjectName     = $"{projectType}{framework}{singlePageName}{ShortLanguageName(language)}";
            DestinationPath = Path.Combine(_fixture.TestProjectsPath, ProjectName, ProjectName);
            OutputPath      = DestinationPath;

            var userSelection = _fixture.SetupProject(projectType, framework, Platforms.Uwp, language);

            foreach (var identity in genIdentitiesList)
            {
                ITemplateInfo itemTemplate = _fixture.Templates()
                                             .FirstOrDefault(t => (t.Identity.StartsWith($"{identity}.") || t.Identity.Equals(identity)) &&
                                                             t.GetFrameworkList().Contains(framework));

                _fixture.AddItem(userSelection, itemTemplate, BaseGenAndBuildFixture.GetDefaultName);

                // Add multiple pages if supported to check these are handled the same
                if (itemTemplate.GetMultipleInstance())
                {
                    _fixture.AddItem(userSelection, itemTemplate, BaseGenAndBuildFixture.GetDefaultName);
                }
            }

            if (lastPageIsHome)
            {
                // Useful if creating a blank project type and want to change the start page
                userSelection.HomeName = userSelection.Pages.Last().name;

                if (projectType == "TabbedPivot")
                {
                    userSelection.Pages.Reverse();
                }
            }

            await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection);

            var resultPath = Path.Combine(_fixture.TestProjectsPath, ProjectName);

            return(resultPath, ProjectName);
        }
        protected async Task <(string ProjectPath, string ProjecName)> AssertGenerationOneByOneAsync(string itemName, string projectType, string framework, string platform, string itemId, string language, bool cleanGeneration = true)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(language);
            BaseGenAndBuildFixture.SetCurrentPlatform(platform);

            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     = $"{ShortProjectType(projectType)}{finalName}{ShortLanguageName(language)}";
            var destinationPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = destinationPath,
                GenerationOutputPath = destinationPath,
            };

            var userSelection = _fixture.SetupProject(projectType, framework, platform, language);
            var templateInfo  = GenContext.ToolBox.Repo.GetTemplateInfo(itemTemplate, platform, projectType, framework, _emptyBackendFramework);

            _fixture.AddItem(userSelection, templateInfo, BaseGenAndBuildFixture.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);
        }
Example #7
0
        protected async Task <(string ProjectPath, string ProjectName)> SetUpWpfComparisonProjectAsync(string language, string projectType, string framework, IEnumerable <string> genIdentities)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(language);
            BaseGenAndBuildFixture.SetCurrentPlatform(Platforms.Wpf);

            var singlePageName = string.Empty;

            var genIdentitiesList = genIdentities.ToList();

            if (genIdentitiesList.Count == 1)
            {
                singlePageName = genIdentitiesList.Last().Split('.').Last();
            }

            var projectName     = $"{projectType}{framework}{singlePageName}{ShortLanguageName(language)}";
            var destinationPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = destinationPath,
                GenerationOutputPath = destinationPath,
            };

            var context = new UserSelectionContext(language, Platforms.Wpf)
            {
                ProjectType       = projectType,
                FrontEndFramework = framework,
            };

            var userSelection = _fixture.SetupProject(context);

            foreach (var identity in genIdentitiesList)
            {
                var itemTemplate = _fixture.Templates().FirstOrDefault(t
                                                                       => (t.Identity.StartsWith($"{identity}.", StringComparison.Ordinal) || t.Identity.Equals(identity, StringComparison.Ordinal)) &&
                                                                       (t.GetProjectTypeList().Contains(projectType) || t.GetProjectTypeList().Contains(All)) &&
                                                                       (t.GetFrontEndFrameworkList().Contains(framework) || t.GetFrontEndFrameworkList().Contains(All)));

                var templateInfo = GenContext.ToolBox.Repo.GetTemplateInfo(itemTemplate, context);
                _fixture.AddItem(userSelection, templateInfo, BaseGenAndBuildFixture.GetDefaultName);
            }

            await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection);

            var resultPath = Path.Combine(_fixture.TestProjectsPath, GenContext.Current.ProjectName);

            return(resultPath, GenContext.Current.ProjectName);
        }
        private async Task <string> GenerateProjectForTestingAsync(string projectName, string projectType, string framework, string platform, string language)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(language);
            BaseGenAndBuildFixture.SetCurrentPlatform(platform);

            // To initialize the list correctly
            var projectTemplate = _fixture.Templates().FirstOrDefault(t =>
                                                                      t.GetTemplateType() == TemplateType.Project &&
                                                                      t.GetProjectTypeList().Contains(projectType) &&
                                                                      t.GetFrontEndFrameworkList().Contains(framework));

            var destinationPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = destinationPath,
                GenerationOutputPath = destinationPath,
            };

            var context = new UserSelectionContext(language, platform)
            {
                ProjectType       = projectType,
                FrontEndFramework = framework,
            };

            var userSelection = _fixture.SetupProject(context);

            var templates = _fixture.Templates()
                            .Where(t => t.GetTemplateType().IsItemTemplate() &&
                                   t.GetFrontEndFrameworkList().Contains(framework) &&
                                   t.GetPlatform() == platform &&
                                   !excludedTemplates_Uwp_Group1.Contains(t.GroupIdentity) &&
                                   !excludedTemplatesGroup1VB.Contains(t.GroupIdentity) &&
                                   !t.GetIsHidden());

            var templatesInfo = GenContext.ToolBox.Repo.GetTemplatesInfo(templates, context);

            _fixture.AddItems(userSelection, templatesInfo, BaseGenAndBuildFixture.GetDefaultName);

            await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection);

            var resultPath = Path.Combine(_fixture.TestProjectsPath, projectName);

            return(resultPath);
        }
Example #9
0
        protected async Task <(string ProjectPath, string ProjecName)> AssertGenerationOneByOneAsync(string itemName, UserSelectionContext context, string itemId, bool cleanGeneration = true)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(context.Language);
            BaseGenAndBuildFixture.SetCurrentPlatform(context.Platform);

            var itemTemplate = _fixture.Templates().FirstOrDefault(t => t.Identity == itemId);
            var finalName    = itemTemplate.GetDefaultName();

            if (itemTemplate.GetItemNameEditable())
            {
                var nameValidationService = new ItemNameService(GenContext.ToolBox.Repo.ItemNameValidationConfig, () => new string[] { });
                finalName = nameValidationService.Infer(finalName);
            }

            var projectName     = $"{ShortProjectType(context.ProjectType)}{finalName}{ShortLanguageName(context.Language)}";
            var destinationPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = destinationPath,
                GenerationOutputPath = destinationPath,
            };

            var userSelection = _fixture.SetupProject(context);
            var templateInfo  = GenContext.ToolBox.Repo.GetTemplateInfo(itemTemplate, context);

            _fixture.AddItem(userSelection, templateInfo, BaseGenAndBuildFixture.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);
        }
        protected async Task <string> AssertGenerateProjectAsync(Func <ITemplateInfo, bool> projectTemplateSelector, string projectName, string projectType, string framework, string platform, string language, Func <ITemplateInfo, bool> itemTemplatesSelector = null, Func <ITemplateInfo, string> getName = null, bool cleanGeneration = true)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(language);
            BaseGenAndBuildFixture.SetCurrentPlatform(platform);

            var targetProjectTemplate = _fixture.Templates().FirstOrDefault(projectTemplateSelector);
            var destinationPath       = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = destinationPath,
                GenerationOutputPath = destinationPath,
            };

            var userSelection = _fixture.SetupProject(projectType, framework, platform, language);

            if (getName != null && itemTemplatesSelector != null)
            {
                var itemTemplates = _fixture.Templates().Where(itemTemplatesSelector);
                _fixture.AddItems(userSelection, itemTemplates, 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);

            if (platform == Platforms.Uwp)
            {
                AssertCorrectProjectConfigInfo(projectType, framework, platform);
            }

            // Clean
            if (cleanGeneration)
            {
                Fs.SafeDeleteDirectory(resultPath);
            }

            return(resultPath);
        }
Example #11
0
        protected async Task <string> AssertGenerateProjectAsync(string projectName, UserSelectionContext context, Func <ITemplateInfo, bool> itemTemplatesSelector = null, Func <TemplateInfo, string> getName = null, bool includeMultipleInstances = false)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(context.Language);
            BaseGenAndBuildFixture.SetCurrentPlatform(context.Platform);

            var destinationPath = Path.Combine(_fixture.TestProjectsPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = destinationPath,
                GenerationOutputPath = destinationPath,
            };

            var userSelection = _fixture.SetupProject(context);

            if (getName != null && itemTemplatesSelector != null)
            {
                var itemTemplates = _fixture.Templates().Where(itemTemplatesSelector);

                var itemsTemplateInfo = GenContext.ToolBox.Repo.GetTemplatesInfo(itemTemplates, context);
                _fixture.AddItems(userSelection, itemsTemplateInfo, getName, includeMultipleInstances);
            }

            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);

            if (context.Platform == Platforms.Uwp)
            {
                AssertCorrectProjectConfigInfo(context);
            }

            return(resultPath);
        }
Example #12
0
        protected async Task <string> AssertGenerateRightClickAsync(string projectName, UserSelectionContext context, bool emptyProject, List <string> excludedGroupIdentity = null)
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(context.Language);
            BaseGenAndBuildFixture.SetCurrentPlatform(context.Platform);
            var path = Path.Combine(_fixture.TestNewItemPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = path,
                GenerationOutputPath = path,
            };

            var userSelection = _fixture.SetupProject(context);
            var appModel      = context.GetAppModel();

            if (!emptyProject)
            {
                var templates = _fixture.Templates().Where(
                    t => t.GetTemplateType().IsItemTemplate() &&
                    (t.GetProjectTypeList().Contains(context.ProjectType) || t.GetProjectTypeList().Contains(All)) &&
                    (t.GetFrontEndFrameworkList().Contains(context.FrontEndFramework) || t.GetFrontEndFrameworkList().Contains(All)) &&
                    t.GetPlatform() == context.Platform &&
                    (string.IsNullOrEmpty(appModel) || t.GetPropertyBagValuesList("appmodel").Contains(appModel) || t.GetPropertyBagValuesList("appmodel").Contains(All)) &&
                    (excludedGroupIdentity == null || (!excludedGroupIdentity.Contains(t.GroupIdentity))) &&
                    !t.GetIsHidden());

                var templatesInfo = GenContext.ToolBox.Repo.GetTemplatesInfo(templates, context);

                _fixture.AddItems(userSelection, templatesInfo, BaseGenAndBuildFixture.GetDefaultName);
            }

            await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection);

            var project = Path.Combine(_fixture.TestNewItemPath, projectName);

            // Assert on project
            Assert.True(Directory.Exists(project));

            int emptyProjecFileCount = Directory.GetFiles(project, "*.*", SearchOption.AllDirectories).Count();

            Assert.True(emptyProjecFileCount > 2);

            var rightClickTemplates = _fixture.Templates().Where(
                t => t.GetTemplateType().IsItemTemplate() &&
                (t.GetProjectTypeList().Contains(context.ProjectType) || t.GetProjectTypeList().Contains(All)) &&
                (t.GetFrontEndFrameworkList().Contains(context.FrontEndFramework) || t.GetFrontEndFrameworkList().Contains(All)) &&
                t.GetPlatform() == context.Platform &&
                (string.IsNullOrEmpty(appModel) || t.GetPropertyBagValuesList("appmodel").Contains(appModel) || t.GetPropertyBagValuesList("appmodel").Contains(All)) &&
                !t.GetIsHidden() &&
                (excludedGroupIdentity == null || (!excludedGroupIdentity.Contains(t.GroupIdentity))) &&
                t.GetRightClickEnabled());

            await AddRightClickTemplatesAsync(path, rightClickTemplates, projectName, context.ProjectType, context.FrontEndFramework, context.Platform, context.Language);

            var finalProjectPath      = Path.Combine(_fixture.TestNewItemPath, projectName);
            int finalProjectFileCount = Directory.GetFiles(finalProjectPath, "*.*", SearchOption.AllDirectories).Count();

            if (emptyProject)
            {
                Assert.True(finalProjectFileCount > emptyProjecFileCount);
            }
            else
            {
                Assert.True(finalProjectFileCount == emptyProjecFileCount);
            }

            return(finalProjectPath);
        }
        protected async Task <string> AssertGenerateRightClickAsync(string projectName, string projectType, string framework, string platform, string language, bool emptyProject, string excludedGroupIdentity = "")
        {
            BaseGenAndBuildFixture.SetCurrentLanguage(language);
            BaseGenAndBuildFixture.SetCurrentPlatform(platform);
            var path = Path.Combine(_fixture.TestNewItemPath, projectName, projectName);

            GenContext.Current = new FakeContextProvider
            {
                ProjectName          = projectName,
                DestinationPath      = path,
                GenerationOutputPath = path,
            };

            var userSelection = _fixture.SetupProject(projectType, framework, platform, language);

            if (!emptyProject)
            {
                var templates = _fixture.Templates().Where(
                    t => t.GetTemplateType().IsItemTemplate() &&
                    (t.GetProjectTypeList().Contains(projectType) || t.GetProjectTypeList().Contains(All)) &&
                    t.GetFrontEndFrameworkList().Contains(framework) &&
                    t.GetPlatform() == platform &&
                    t.GroupIdentity != excludedGroupIdentity &&
                    !t.GetIsHidden());

                var templatesInfo = GenContext.ToolBox.Repo.GetTemplatesInfo(templates, platform, projectType, framework, _emptyBackendFramework);

                _fixture.AddItems(userSelection, templatesInfo, BaseGenAndBuildFixture.GetDefaultName);
            }

            await NewProjectGenController.Instance.UnsafeGenerateProjectAsync(userSelection);

            var project = Path.Combine(_fixture.TestNewItemPath, projectName);

            // Assert on project
            Assert.True(Directory.Exists(project));

            int emptyProjecFileCount = Directory.GetFiles(project, "*.*", SearchOption.AllDirectories).Count();

            Assert.True(emptyProjecFileCount > 2);

            var rightClickTemplates = _fixture.Templates().Where(
                t => t.GetTemplateType().IsItemTemplate() &&
                (t.GetProjectTypeList().Contains(projectType) || t.GetProjectTypeList().Contains(All)) &&
                t.GetFrontEndFrameworkList().Contains(framework) &&
                t.GetPlatform() == platform &&
                !t.GetIsHidden() &&
                t.GetRightClickEnabled());

            await AddRightClickTemplatesAsync(path, rightClickTemplates, projectName, projectType, framework, platform, language);

            var finalProjectPath      = Path.Combine(_fixture.TestNewItemPath, projectName);
            int finalProjectFileCount = Directory.GetFiles(finalProjectPath, "*.*", SearchOption.AllDirectories).Count();

            if (emptyProject)
            {
                Assert.True(finalProjectFileCount > emptyProjecFileCount);
            }
            else
            {
                Assert.True(finalProjectFileCount == emptyProjecFileCount);
            }

            return(finalProjectPath);
        }