Exemplo n.º 1
0
        public async Task When_summary_has_see_tag_then_it_is_converted()
        {
            //// Arrange
            await XmlDocumentationExtensions.ClearCacheAsync();

            //// Act
            var summary = await typeof(WithSeeTagInXmlDoc).GetProperty("Foo").GetXmlSummaryAsync();

            //// Assert
            Assert.Equal("null for the default Record. See this and this at https://github.com/rsuter/njsonschema.", summary);
        }
Exemplo n.º 2
0
        public async Task When_method_has_inheritdoc_then_on_interface_it_is_resolved()
        {
            //// Arrange
            await XmlDocumentationExtensions.ClearCacheAsync();

            //// Act
            var methodSummary = await typeof(ClassWithInheritdocOnInterface).GetMethod("Bar").GetXmlSummaryAsync();

            //// Assert
            Assert.Equal("Bar.", methodSummary);
        }
Exemplo n.º 3
0
        public async Task When_property_has_inheritdoc_on_interface_then_it_is_resolved()
        {
            //// Arrange
            await XmlDocumentationExtensions.ClearCacheAsync();

            //// Act
            var propertySummary = await typeof(ClassWithInheritdocOnInterface).GetProperty("Foo").GetXmlSummaryAsync();

            //// Assert
            Assert.Equal("Foo.", propertySummary);
        }
Exemplo n.º 4
0
        public async Task When_summary_has_generic_tags_then_it_is_converted()
        {
            //// Arrange
            await XmlDocumentationExtensions.ClearCacheAsync();

            //// Act
            var summary = await typeof(WithGenericTagsInXmlDoc).GetProperty("Foo").GetXmlSummaryAsync();

            //// Assert
            Assert.Equal("This are some tags.", summary);
        }
Exemplo n.º 5
0
        public async Task When_parameter_has_inheritdoc_on_interface_then_it_is_resolved()
        {
            //// Arrange
            await XmlDocumentationExtensions.ClearCacheAsync();

            //// Act
            var parameterXml = await typeof(ClassWithInheritdocOnInterface).GetMethod("Bar").GetParameters()
                               .Single(p => p.Name == "baz").GetXmlDocumentationAsync();

            //// Assert
            Assert.Equal("Baz.", parameterXml);
        }
Exemplo n.º 6
0
        public async Task When_xml_doc_is_missing_then_summary_is_missing()
        {
            //// Arrange
            await XmlDocumentationExtensions.ClearCacheAsync();

            //// Act
            var summary  = await typeof(Point).GetXmlSummaryAsync();
            var summary2 = await typeof(Point).GetXmlSummaryAsync();

            //// Assert
            Assert.Empty(summary);
        }
Exemplo n.º 7
0
        public async Task When_xml_doc_with_multiple_breaks_is_read_then_they_are_not_stripped_away()
        {
            //// Arrange
            await XmlDocumentationExtensions.ClearCacheAsync();

            //// Act
            var summary = await typeof(WithComplexXmlDoc).GetProperty("Foo").GetXmlSummaryAsync();

            //// Assert
            Assert.Contains("\n\n", summary);
            Assert.Contains("    * Users", summary);
            Assert.Equal(summary.Trim(), summary);
        }
Exemplo n.º 8
0
        public async Task When_xml_doc_contains_xml_then_it_is_fully_read()
        {
            //// Arrange
            await XmlDocumentationExtensions.ClearCacheAsync();

            //// Act
            var element   = await typeof(WithTagsInXmlDoc).GetProperty("Foo").GetXmlDocumentationAsync();
            var responses = element.Elements("response");

            //// Assert
            Assert.Equal(2, responses.Count());

            Assert.Equal("Account created", responses.First().Value);
            Assert.Equal("201", responses.First().Attribute("code").Value);

            Assert.Equal("Username already in use", responses.Last().Value);
            Assert.Equal("400", responses.Last().Attribute("code").Value);
        }
Exemplo n.º 9
0
 public void XmlDocTestsWithoutCache()
 {
     XmlDocumentationExtensions.ClearCacheAsync().GetAwaiter().GetResult();
     _generatorPerformance.XmlDocTests().GetAwaiter().GetResult();
     _counter.Increment();
 }