diff --git a/src/dotnet/APIView/APIView/Model/V2/ReviewToken.cs b/src/dotnet/APIView/APIView/Model/V2/ReviewToken.cs index fb45f0929eb..94e878f9b48 100644 --- a/src/dotnet/APIView/APIView/Model/V2/ReviewToken.cs +++ b/src/dotnet/APIView/APIView/Model/V2/ReviewToken.cs @@ -57,7 +57,7 @@ public ReviewToken(string value, TokenKind kind) /// /// Language specific style css class names /// - public List RenderClasses = []; + public List RenderClasses { get; set; } = []; public static ReviewToken CreateTextToken(string value, string navigateToId = null, bool hasSuffixSpace = true) { diff --git a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParserTests/CodeFileTests.cs b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParserTests/CodeFileTests.cs index 59aea555c7d..40fa294b3d9 100644 --- a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParserTests/CodeFileTests.cs +++ b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParserTests/CodeFileTests.cs @@ -6,6 +6,7 @@ using Newtonsoft.Json.Schema; using Newtonsoft.Json.Linq; using System.Text.Json.Serialization; +using APIView.Model.V2; namespace CSharpAPIParserTests @@ -126,5 +127,25 @@ private bool validateSchema(CodeFile codeFile) } return isValid; } + + [Fact] + public void TestNavigatonNodeHasRenderingClass() + { + var jsonString = JsonSerializer.Serialize(codeFile); + var parsedCodeFile = JsonSerializer.Deserialize(jsonString); + Assert.Equal(8, CountNavigationNodes(parsedCodeFile.ReviewLines)); + } + + private int CountNavigationNodes(List lines) + { + int count = 0; + foreach (var line in lines) + { + var navTokens = line.Tokens.Where(x=> x.NavigationDisplayName != null); + count += navTokens.Count(x => x.RenderClasses.Any()); + count += CountNavigationNodes(line.Children); + } + return count; + } } }