Пример #1
0
        public void ShouldNotAddSummaryDocCommentsClassDeclarationWithSummaryComments()
        {
            var classDecl =
                @"        /// <summary>
        /// A summary description
        /// </summary>
        public class Class1
        {
        }";
            var tree            = CSharpSyntaxTree.ParseText(classDecl);
            var rewriter        = new DocumentCommentsRewriter();
            var root            = (CompilationUnitSyntax)tree.GetRoot();
            var classDeclSyntax = (ClassDeclarationSyntax)root.Members[0];

            var result = rewriter.VisitClassDeclaration(classDeclSyntax);

            Assert.Equal(classDecl, result.ToFullString());
        }
Пример #2
0
        public void ShouldNotAddSummaryDocCommentsToNoAccessClassDeclaration()
        {
            var classDecl =
                @"    class Class1
    {
    }";
            var expected =
                @"    class Class1
    {
    }";
            var tree            = CSharpSyntaxTree.ParseText(classDecl);
            var rewriter        = new DocumentCommentsRewriter();
            var root            = (CompilationUnitSyntax)tree.GetRoot();
            var classDeclSyntax = (ClassDeclarationSyntax)root.Members[0];

            var result = rewriter.VisitClassDeclaration(classDeclSyntax);

            Assert.Equal(expected, result.ToFullString());
        }
Пример #3
0
        public void ShouldRetainOneLineSummaryDocumentationComments()
        {
            var classDecl =
                @"    /// <summary>A summary comment.</summary>
    internal class Class1
    {
    }";
            var expected =
                @"    /// <summary>A summary comment.</summary>
    internal class Class1
    {
    }";
            var tree            = CSharpSyntaxTree.ParseText(classDecl);
            var rewriter        = new DocumentCommentsRewriter();
            var root            = (CompilationUnitSyntax)tree.GetRoot();
            var classDeclSyntax = (ClassDeclarationSyntax)root.Members[0];

            var result = rewriter.VisitClassDeclaration(classDeclSyntax);

            Assert.Equal(expected, result.ToFullString());
        }
Пример #4
0
        public void ShoulAddSummaryAndNotSeeAlsoCommentsForUndefinedChildClass()
        {
            var classDecl =
                @"    internal class Class1 : Class0
    {
    }";
            var expected =
                @"    /// <summary>
    /// 
    /// </summary>
    internal class Class1 : Class0
    {
    }";
            var tree            = CSharpSyntaxTree.ParseText(classDecl);
            var rewriter        = new DocumentCommentsRewriter();
            var root            = (CompilationUnitSyntax)tree.GetRoot();
            var classDeclSyntax = (ClassDeclarationSyntax)root.Members[0];

            var result = rewriter.VisitClassDeclaration(classDeclSyntax);

            Assert.Equal(expected, result.ToFullString());
        }