예제 #1
0
 public static ClassDeclarationSyntax AddClassBlockComment(
     this ClassDeclarationSyntax classDeclaration,
     string commentText,
     int lineCharacterSoftLimit = Constants.DefaultCommentLineCharacterLimit,
     bool atStart = true)
 {
     return(classDeclaration.AddClassBlockComment(CommentWordWrap(commentText, lineCharacterSoftLimit), atStart));
 }
예제 #2
0
        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)));
        }