Beispiel #1
0
 public void DocumentationComment(params string[] documentationCommentLines)
 {
     if (builder.AnyCommentLines(documentationCommentLines))
     {
         SetCurrentState(State.DocumentationComment);
         builder.DocumentationComment(documentationCommentLines);
     }
 }
Beispiel #2
0
        public void DocumentCommentWithNoContents()
        {
            JSBuilder builder = new JSBuilder();

            builder.DocumentationComment(comment => { });
            Assert.AreEqual("", builder.ToString());
        }
Beispiel #3
0
        public void DocumentationCommentWithDescription()
        {
            JSBuilder builder = new JSBuilder();

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

            builder.DocumentationComment(comment =>
            {
                comment.Description("This is my description.");
                comment.Parameter("parameterName", "parameterType", "This is my parameter description.");
            });
            AssertEx.EqualLines(
                "/**\n" +
                " * This is my description.\n" +
                " * @param {parameterType} parameterName This is my parameter description.\n" +
                " */",
                builder);
        }
Beispiel #5
0
        public void DocumentationCommentWithLeadingWhitespaceInDescription()
        {
            JSBuilder builder = new JSBuilder();

            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);
        }
Beispiel #6
0
        public void DocumentationCommentWithWrappedDescription()
        {
            JSBuilder builder = new JSBuilder(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);
        }