Ejemplo n.º 1
0
        public void ShouldDocument(string uncommentedCode, string expectedCommentedCode)
        {
            // Arrange
            var options = new CtorDocumentationOptions
            {
                Enabled  = true,
                Required = true,
                Summary  = new SummaryDocumentationOptions
                {
                    Template = "Creates a new instance of the {name} class."
                },
                Parameters = new ParamsDocumentationOptions
                {
                    Enabled  = true,
                    Template = "The {name}."
                },
                Exceptions = new ExceptionDocumentationOptions
                {
                    Enabled = true
                }
            };

            var ctorDeclarationSyntax = SyntaxUtils.Parse <ConstructorDeclarationSyntax>(uncommentedCode);

            var strategy = new ConstructorDocumentationStrategy(NullLogger <ConstructorDocumentationStrategy> .Instance,
                                                                new HumanizeFormatter(new DocumentationOptions()),
                                                                options);

            // Act
            var documentedSyntax = strategy.Apply(ctorDeclarationSyntax);

            // Assert
            documentedSyntax.ToFullString().Trim().ShouldBe(expectedCommentedCode.Trim());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConstructorDocumentationStrategy" /> class
 /// </summary>
 /// <param name="logger">The logger</param>
 /// <param name="formatter">The formatter</param>
 /// <param name="options">The options</param>
 public ConstructorDocumentationStrategy(ILogger <ConstructorDocumentationStrategy> logger,
                                         IFormatter formatter, CtorDocumentationOptions options) =>
 (_logger, _formatter, _options) = (logger, formatter, options);