async void ExecuteSearchAuthor()
 {
     var searcher = new TemplateSearcher();
     IList <Template> foundTemplates = searcher.SearchByAuthor(Pack.Authors, new TemplateHelper().GetTemplatePacks());
     await Navigation.PushAsync(
         new NavigationPage(new SearchPage($"author=\"{Pack.Authors}\"", foundTemplates)));
 }
        public async Task OnGetAsync(string packId, string templateId)
        {
            PackId     = packId;
            TemplateId = templateId;

            TemplatePack = await GetFromApiAsync <TemplatePack>($"templatepack/{packId}");

            Template = new TemplateSearcher().GetTemplateById(TemplateId, TemplatePack);
        }
        public void OnGet(string packId, string templateId)
        {
            PackId     = packId;
            TemplateId = templateId;

            TemplatePack = GetFromApi <TemplatePack>($"templatepack/{packId}");
            Template     = new TemplateSearcher().GetTemplateById(TemplateId, TemplatePack);
            // new TemplateSearcher().FindTemplatePackById(templateName, new l)
            // get the template pack
            // http://localhost:61747/api/templatepack/Microsoft.AspNetCore.SpaTemplates
        }
Ejemplo n.º 4
0
        public void SearcherCorrectlyFiltersSpecifiedPack()
        {
            const string templateName = "foo";

            TemplateSearcher searcher = new TemplateSearcher(EngineEnvironmentSettings, "C#", MockTemplateSearchHelpers.DefaultMatchFilter);

            IReadOnlyList <IInstallUnitDescriptor> packsToIgnore = new List <IInstallUnitDescriptor>()
            {
                _fooPackInstallDescriptor
            };

            SearchResults searchResults = searcher.SearchForTemplatesAsync(packsToIgnore, templateName).Result;

            Assert.Equal(0, searchResults.MatchesBySource.Count);
        }
Ejemplo n.º 5
0
        public void SearcherCorrectlyFiltersSpecifiedPack()
        {
            const string templateName = "foo";

            TemplateSearcher searcher = new TemplateSearcher(_engineEnvironmentSettings, "C#", MockTemplateSearchHelpers.DefaultMatchFilter);

            IReadOnlyList <IManagedTemplatePackage> packsToIgnore = new List <IManagedTemplatePackage>()
            {
                new MockManagedTemplatePackage()
            };

            SearchResults searchResults = searcher.SearchForTemplatesAsync(packsToIgnore, templateName).Result;

            Assert.Equal(0, searchResults.MatchesBySource.Count);
        }
Ejemplo n.º 6
0
        public void SourcesCorrectlySearchOnName()
        {
            MockTemplateSearchSource.ClearResultsForAllSources();
            IReadOnlyDictionary <string, Guid> sourceNameToIdMap = MockTemplateSearchSource.SetupMultipleSources(EngineEnvironmentSettings, GetMockNameSearchResults());

            const string templateName = "foo";

            TemplateSearcher searcher = new TemplateSearcher(EngineEnvironmentSettings, "C#", MockTemplateSearchHelpers.DefaultMatchFilter);
            List <IInstallUnitDescriptor> existingInstalls = new List <IInstallUnitDescriptor>();
            SearchResults searchResults = searcher.SearchForTemplatesAsync(existingInstalls, templateName).Result;

            Assert.True(searchResults.AnySources);
            Assert.Equal(1, searchResults.MatchesBySource.Count);
            Assert.Equal("source one", searchResults.MatchesBySource[0].SourceDisplayName);
            Assert.Equal(1, searchResults.MatchesBySource[0].PacksWithMatches.Count);
            Assert.True(searchResults.MatchesBySource[0].PacksWithMatches.ContainsKey(_fooPackInfo));

            Assert.Single(searchResults.MatchesBySource[0].PacksWithMatches[_fooPackInfo].TemplateMatches.Where(x => string.Equals(x.Info.Name, "MockFooTemplateOne")));
            Assert.Single(searchResults.MatchesBySource[0].PacksWithMatches[_fooPackInfo].TemplateMatches.Where(x => string.Equals(x.Info.Name, "MockFooTemplateTwo")));
        }