public void TestCreateCommentArgumentChecking()
        {
            var decorator = new StandardSchemaCommentDecorator();

            // Confirm that the decorator validates parameters
            Assert.Throws(typeof(ArgumentNullException), () => decorator.CreateComment(null));
        }
        public void TestCreateComment()
        {
            string aShortDescription = "A Short description for test";
            var decorator = new StandardSchemaCommentDecorator();
            var schema = new JsonSchema();
            schema.Description = aShortDescription;

            var result = decorator.CreateComment(schema);
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count);
            Assert.IsNotNull(result[0].Comment);
            Assert.AreEqual(true, result[0].Comment.DocComment);
            Assert.AreEqual("<summary>" + aShortDescription + "</summary>", result[0].Comment.Text);
        }
        public void TestCreateComment_emptyComment()
        {
            var decorator = new StandardSchemaCommentDecorator();

            var schema = new JsonSchema();
            schema.Description = null;
            var result = decorator.CreateComment(schema);
            // When called with a schmea that has no Description we should return an empty collection.
            Assert.IsNotNull(result);
            Assert.IsEmpty(result);

            schema.Description = "";
            result = decorator.CreateComment(schema);
            // When called with a schmea that has an empty Description we should return an empty collection.
            Assert.IsNotNull(result);
            Assert.IsEmpty(result);
        }
        public void TestCreateComment_xmlEscape()
        {
            string aShortDescription = "A 'Short\" <description> <for/> test & fun";
            var decorator = new StandardSchemaCommentDecorator();
            var schema = new JsonSchema();
            schema.Description = aShortDescription;

            var result = decorator.CreateComment(schema);
            string desiredComment =
                "<summary>A &apos;Short&quot; &lt;description&gt; &lt;for/&gt; test &amp; fun</summary>";
            Assert.AreEqual(desiredComment, result[0].Comment.Text);
        }