public static ClassDeclarationSyntax AddClassBlockComment( this ClassDeclarationSyntax classDeclaration, string commentText, int lineCharacterSoftLimit = Constants.DefaultCommentLineCharacterLimit, bool atStart = true) { return(classDeclaration.AddClassBlockComment(CommentWordWrap(commentText, lineCharacterSoftLimit), atStart)); }
public void AddClassBlockComment_Places_Leading_Text_Before_Block_Content() { var classDec = _testClassDeclaration.AddClassBlockComment(TestStatementCommentShort); // Class braces tend to have extra white space trivia attached // so we filter those out for the check Assert.IsEmpty(classDec.OpenBraceToken.LeadingTrivia.Where(trivia => trivia.IsKind(SyntaxKind.SingleLineCommentTrivia) || trivia.IsKind(SyntaxKind.MultiLineCommentTrivia))); Assert.AreEqual(BraceTestCommentText, classDec.OpenBraceToken.TrailingTrivia.Where(trivia => trivia.IsKind(SyntaxKind.SingleLineCommentTrivia) || trivia.IsKind(SyntaxKind.MultiLineCommentTrivia)).Single().ToFullString()); Assert.IsEmpty(classDec.CloseBraceToken.LeadingTrivia.Where(trivia => trivia.IsKind(SyntaxKind.SingleLineCommentTrivia) || trivia.IsKind(SyntaxKind.MultiLineCommentTrivia))); Assert.IsEmpty(classDec.CloseBraceToken.TrailingTrivia.Where(trivia => trivia.IsKind(SyntaxKind.SingleLineCommentTrivia) || trivia.IsKind(SyntaxKind.MultiLineCommentTrivia))); }