public void CreateMarkdownDocument()
        {
            var markdown = new Markdown.Document();

            markdown
            .Append(new Markdown.Header1("header - level 1"))
            .Append(new Markdown.Header2("header - level 2"))
            .Append(new Markdown.Header3("header - level 3"))
            .Append(new Markdown.Paragraph("some text"))
            .Append(new Markdown.Code("var code = new PieceOfCode();"))
            .Append(SampleTable())
            .Append(new Markdown.Quote("some quote"));

            var writer = new MarkdownTextWriter(markdown.ToString());

            Approvals.Verify(writer);

            Markdown.Table SampleTable()
            {
                var table = new Markdown.Table("column 1", "column 2");

                table.Append("cell 1", "cell 2");
                return(table);
            }
        }
        public Markdown.Table GenerateExampleTableForGetFriendlyMethodName(MethodInfo[] methods)
        {
            var table = new Markdown.Table("Method", "Friendly name");

            foreach (var method in methods)
            {
                table.Append(method.ToString(), method.GetFriendlyMethodName());
            }

            return(table);
        }
        private static Markdown.Table GenerateExampleTable(List <Type> types)
        {
            var table = new Markdown.Table("Input type", "Friendly name");

            foreach (var type in types)
            {
                table.Append(type.ToString(), type.GetFriendlyTypeName());
            }

            return(table);
        }
        public ClassDocumentation(Type type)
        {
            var docTypeName = $"{type.Namespace}.{type.Name}";
            var docsFile    = Path.ChangeExtension(typeof(Business).Assembly.Location, "xml");
            var xml         = new XmlDocument();

            xml.Load(docsFile);
            var summary = xml.DocumentElement.SelectSingleNode($"//*[@name='T:{docTypeName}']/summary")
                          ?.InnerText.Trim();

            this.Append(new Markdown.Header1(nameof(Business) + " class"))
            .Append(new Markdown.Header2("Definition"))
            .Append(new Markdown.Paragraph($"Namespace: {type.Namespace}<br/>")
                    .Line($"Assembly: {type.Assembly.GetName().Name}.dll"))
            .Append(new Markdown.Paragraph(summary));

            var remarks = xml.DocumentElement.SelectSingleNode($"//*[@name='T:{docTypeName}']/remarks")
                          ?.InnerText.Trim();

            if (String.IsNullOrWhiteSpace(remarks) == false)
            {
                this.Append(new Markdown.Header2("Remarks"))
                .Append(new Markdown.Paragraph(remarks));
            }

            var methods = type.GetMethods(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.Static)
                          .Where(m => ApiDescription.NotIn(m.Name,
                                                           nameof(this.GetType),
                                                           nameof(this.ToString),
                                                           nameof(Equals),
                                                           nameof(object.ReferenceEquals),
                                                           nameof(this.GetHashCode)));

            if (methods.Any())
            {
                this.Append(new Markdown.Header2("Methods"));
                var table = new Markdown.Table("Name", "Summary");
                foreach (MethodInfo method in methods)
                {
                    var methodNameInDocumentation = method.ToString();
                    methodNameInDocumentation = methodNameInDocumentation.Substring(methodNameInDocumentation.IndexOf(" ") + 1);
                    var methodSummarry = xml.DocumentElement.SelectSingleNode($"//*[@name='M:{docTypeName}.{methodNameInDocumentation}']/summary")
                                         ?.InnerText.Trim();
                    table.Append(method.GetFriendlyMethodName(), methodSummarry);
                }

                this.Append(table);
            }
        }