public void GetTagHelpers_DiscoversTagHelpers() { // Arrange var code = $@" public class TestTagHelper : {typeof(TagHelper).FullName} {{ }}"; var syntaxTree = CSharpSyntaxTree.ParseText(code); var compilation = TestCompilation.Create(Assembly, syntaxTree); var tagHelperResolver = new DefaultTagHelperResolver() { ForceEnableViewComponentDiscovery = true }; // Act var result = tagHelperResolver.GetTagHelpers(compilation); // Assert Assert.Empty(result.Diagnostics); Assert.Equal(1, result.Descriptors.Count); }
public void GetTagHelpers_DiscoversViewComponentTagHelpers() { // Arrange var code = @" public class TestViewComponent { public string Invoke(string foo, string bar) => null; }"; var syntaxTree = CSharpSyntaxTree.ParseText(code); var compilation = TestCompilation.Create(Assembly, syntaxTree); var tagHelperResolver = new DefaultTagHelperResolver() { ForceEnableViewComponentDiscovery = true }; // Act var result = tagHelperResolver.GetTagHelpers(compilation); // Assert Assert.Empty(result.Diagnostics); Assert.Equal(1, result.Descriptors.Count); }