public void GetFriendlyMethodName()
        {
            var documentation = new Markdown.Document();

            documentation.Append(new Markdown.Header1(nameof(MethodInfo) + "." + nameof(ReflectionExtensions.GetFriendlyMethodName) + "() extension method"))
            .Append(new Markdown.Header2("Definition"))
            .Append(new Markdown.Paragraph($"Namespace: {typeof(ReflectionExtensions).Namespace}<br/>")
                    .Line($"Assembly: {typeof(ReflectionExtensions).Assembly.GetName().Name}.dll"))
            .Append(new Markdown.Paragraph("Returns friendly name of a method."));

            documentation.Append(new Markdown.Header2("Remarks"))
            .Append(new Markdown.Paragraph("This method is intended to be used mainly for testing purposes."));

            documentation.Append(new Markdown.Header2("Examples"))
            .Append(this.GetSampleUsageOfGetFriendlyMethodName())
            .Append(new Markdown.Paragraph("The following example table shows result of method execution on System.String public methods"))
            .Append(this.GenerateExampleTableForGetFriendlyMethodName(typeof(string).GetMethods()))
            .Append(new Markdown.Paragraph("The following example table shows result of method execution on some other methods"))
            .Append(this.GenerateExampleTableForGetFriendlyMethodName(new[] { this.GetType().GetMethod(nameof(GenerateExampleTableForGetFriendlyMethodName)) }))
            ;

            var writer = new MarkdownTextWriter(documentation);

            Approvals.Verify(writer);
        }
        public void GetFriendlyTypeName()
        {
            var documentation = new Markdown.Document();

            documentation.Append(new Markdown.Header1(nameof(Type) + "." + nameof(ReflectionExtensions.GetFriendlyTypeName) + "() extension method"))
            .Append(new Markdown.Header2("Definition"))
            .Append(new Markdown.Paragraph($"Namespace: {typeof(ReflectionExtensions).Namespace}<br/>")
                    .Line($"Assembly: {typeof(ReflectionExtensions).Assembly.GetName().Name}.dll"))
            .Append(new Markdown.Paragraph("Returns friendly name of Type."));

            documentation.Append(new Markdown.Header2("Remarks"))
            .Append(new Markdown.Paragraph("This method is intended to be used mainly for testing purposes."));

            documentation.Append(new Markdown.Header2("Examples"))
            .Append(this.GetSampleUsageOfGetFriendlyTypeName())
            .Append(new Markdown.Paragraph("The following example table shows result of method execution on C# primitive types"))
            .Append(ReflectionExtensionDocumentation.GenerateExampleTable(this.primitiveTypes))
            .Append(new Markdown.Paragraph("The following example table shows result of method execution on nullable types"))
            .Append(ReflectionExtensionDocumentation.GenerateExampleTable(this.primitiveTypesNullable))
            .Append(new Markdown.Paragraph("The following example table shows result of method execution on some more complex types"))
            .Append(ReflectionExtensionDocumentation.GenerateExampleTable(this.complexTypes));

            var writer = new MarkdownTextWriter(documentation);

            Approvals.Verify(writer);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        public void General()
        {
            var documentation = new Markdown.Document();

            documentation.Append(new ClassDocumentation(typeof(Business)));

            documentation.Append(new Markdown.Header2("Examples"))
            .Append(this.Step1GatherRequirements())
            .Append(this.Step2MakeItWorking())
            .Append(this.Step3IntroduceDedicatedException())
            .Append(this.Step4DocumentTheRequirement())
            .Append(this.Step5GenerateDocumentation())
            .Append(this.QuickSamples())
            .Append(this.ValueObjectExample())
            ;

            var writer = new MarkdownTextWriter(documentation);

            Approvals.Verify(writer);
        }