public void OnExecuteAsync_Should_NotThrow(
            IConsoleOutput console,
            IProgressReporter progressReporter,
            IOpenApiDocumentFactory openApiDocumentFactory,
            INSwagOptions options,
            INSwagCodeGeneratorFactory codeGeneratorFactory,
            ICodeGenerator generator,
            string outputFile,
            string code)
        {
            var sut = new NSwagCommand(
                console,
                progressReporter,
                openApiDocumentFactory,
                options,
                codeGeneratorFactory);

            sut.OutputFile = outputFile;

            Mock.Get(generator)
            .Setup(c => c.GenerateCode(progressReporter))
            .Returns(code);

            new Func <int>(sut.OnExecute).Should().NotThrow();
        }
Exemplo n.º 2
0
 public NSwagSingleFileCustomTool(
     INSwagCodeGeneratorFactory factory,
     IOpenApiDocumentFactory openApiDocumentFactory,
     INSwagOptions options)
 {
     this.factory = factory ?? throw new ArgumentNullException(nameof(factory));
     this.openApiDocumentFactory = openApiDocumentFactory ??
                                   throw new ArgumentNullException(nameof(openApiDocumentFactory));
     this.options = options ?? throw new ArgumentNullException(nameof(options));
 }
 public NSwagCommand(
     IConsoleOutput console,
     IProgressReporter progressReporter,
     IOpenApiDocumentFactory openApiDocumentFactory,
     INSwagOptions options,
     INSwagCodeGeneratorFactory codeGeneratorFactory)
     : base(console, progressReporter)
 {
     this.openApiDocumentFactory = openApiDocumentFactory ?? throw new ArgumentNullException(nameof(openApiDocumentFactory));
     this.options = options ?? throw new ArgumentNullException(nameof(options));
     this.codeGeneratorFactory = codeGeneratorFactory ?? throw new ArgumentNullException(nameof(codeGeneratorFactory));
 }