Exemplo n.º 1
0
 /// <summary>
 /// Add a documentation comment to this TSObject. If no non-null lines are provided, then nothing will be added.
 /// </summary>
 /// <param name="lines">The lines of text to add to the documentation comment.</param>
 public void DocumentationComment(params string[] lines)
 {
     if (builder.AnyCommentLines(lines))
     {
         SetCurrentState(State.BlockComment);
         builder.DocumentationComment(lines);
     }
 }
        public void DeprecatedWithNull()
        {
            TSBuilder builder = new TSBuilder();

            builder.DocumentationComment(comment =>
            {
                comment.Deprecated(null);
            });
            AssertEx.EqualLines("", builder);
        }
Exemplo n.º 3
0
        public void DocumentationCommentWithDescription()
        {
            TSBuilder builder = new TSBuilder();

            builder.DocumentationComment(comment =>
            {
                comment.Description("Hello");
            });
            AssertEx.EqualLines(
                "/**\n" +
                " * Hello\n" +
                " */",
                builder);
        }
Exemplo n.º 4
0
        public void DocumentationCommentWithDescriptionAndParameter()
        {
            TSBuilder builder = new TSBuilder();

            builder.DocumentationComment(comment =>
            {
                comment.Description("This is my description.");
                comment.Parameter("parameterName", "This is my parameter description.");
            });
            AssertEx.EqualLines(
                "/**\n" +
                " * This is my description.\n" +
                " * @param parameterName This is my parameter description.\n" +
                " */",
                builder);
        }
        public void DeprecatedWithNonEmpty()
        {
            TSBuilder builder = new TSBuilder();

            builder.DocumentationComment(comment =>
            {
                comment.Deprecated("abc");
            });
            AssertEx.EqualLines(
                new[]
            {
                "/**",
                " * @deprecated abc",
                " */",
            },
                builder);
        }
        public void DeprecatedWithWhitespace()
        {
            TSBuilder builder = new TSBuilder();

            builder.DocumentationComment(comment =>
            {
                comment.Deprecated("\t  ");
            });
            AssertEx.EqualLines(
                new[]
            {
                "/**",
                " * @deprecated",
                " */",
            },
                builder);
        }
Exemplo n.º 7
0
        public void DocumentationCommentWithLeadingWhitespaceInDescription()
        {
            TSBuilder builder = new TSBuilder();

            builder.DocumentationComment(comment =>
            {
                comment.Description("This\n  is\n\tmy\ndescription.");
            });
            // The leading whitespace in the description should be preserved, but the AutoRest
            // WordWrap() trims away leading whitespace.
            AssertEx.EqualLines(
                "/**\n" +
                " * This\n" +
                " * is\n" +
                " * my\n" +
                " * description.\n" +
                " */",
                builder);
        }
Exemplo n.º 8
0
        public void DocumentationCommentWithWrappedDescription()
        {
            TSBuilder builder = new TSBuilder(10);

            builder.DocumentationComment(comment =>
            {
                comment.Description("This is my long description that will get wrapped.");
            });
            // The AutoRest WordWrap() function seems to include the trailing newline character in
            // its wordwrap algorithm. " * This is" is 10 characters long, so it shouldn't get
            // wrapped, but AutoRest WordWrap() wraps it.
            AssertEx.EqualLines(
                "/**\n" +
                " * This\n" +
                " * is my\n" +
                " * long\n" +
                " * description\n" +
                " * that\n" +
                " * will\n" +
                " * get\n" +
                " * wrapped.\n" +
                " */",
                builder);
        }
Exemplo n.º 9
0
 public void DocumentationComment(Action <TSDocumentationComment> action)
 {
     builder.DocumentationComment(action);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Add a /** */ comment to this TSFile. If no non-null and non-empty lines are provided, then nothing will be added.
 /// </summary>
 /// <param name="lines">The lines to add. Null lines will be ignored.</param>
 public void DocumentationComment(params string[] lines)
 {
     builder.DocumentationComment(lines);
 }