public void TestPerformAllTemplatesInContextQuery() { List <ITemplateInfo> templatesToSearch = new List <ITemplateInfo>(); templatesToSearch.Add(new MockTemplateInfo("Template1", name: "Template1", identity: "Template1") .WithTag("type", "project")); templatesToSearch.Add(new MockTemplateInfo("Template2", name: "Template2", identity: "Template2") .WithTag("type", "item")); templatesToSearch.Add(new MockTemplateInfo("Template3", name: "Template3", identity: "Template3") .WithTag("type", "myType")); templatesToSearch.Add(new MockTemplateInfo("Template4", name: "Template4", identity: "Template4") .WithTag("type", "project")); templatesToSearch.Add(new MockTemplateInfo("Template5", name: "Template5", identity: "Template5") .WithTag("type", "project")); IHostSpecificDataLoader hostDataLoader = new MockHostSpecificDataLoader(); IReadOnlyCollection <ITemplateMatchInfo> projectTemplates = TemplateResolver.PerformAllTemplatesInContextQuery(templatesToSearch, hostDataLoader, "project"); Assert.Equal(3, projectTemplates.Count); Assert.True(projectTemplates.Where(x => string.Equals(x.Info.Identity, "Template1", StringComparison.Ordinal)).Any()); Assert.True(projectTemplates.Where(x => string.Equals(x.Info.Identity, "Template4", StringComparison.Ordinal)).Any()); Assert.True(projectTemplates.Where(x => string.Equals(x.Info.Identity, "Template5", StringComparison.Ordinal)).Any()); IReadOnlyCollection <ITemplateMatchInfo> itemTemplates = TemplateResolver.PerformAllTemplatesInContextQuery(templatesToSearch, hostDataLoader, "item"); Assert.Equal(1, itemTemplates.Count); Assert.True(itemTemplates.Where(x => string.Equals(x.Info.Identity, "Template2", StringComparison.Ordinal)).Any()); //Visual Studio only supports "project" and "item", so using other types is no longer allowed, therefore "other" handling is removed. //support of match on custom type still remains IReadOnlyCollection <ITemplateMatchInfo> otherTemplates = TemplateResolver.PerformAllTemplatesInContextQuery(templatesToSearch, hostDataLoader, "other"); Assert.Equal(0, otherTemplates.Count); Assert.False(otherTemplates.Where(x => string.Equals(x.Info.Identity, "Template3", StringComparison.Ordinal)).Any()); IReadOnlyCollection <ITemplateMatchInfo> customTypeTemplates = TemplateResolver.PerformAllTemplatesInContextQuery(templatesToSearch, hostDataLoader, "myType"); Assert.Equal(1, customTypeTemplates.Count); Assert.True(customTypeTemplates.Where(x => string.Equals(x.Info.Identity, "Template3", StringComparison.Ordinal)).Any()); }