public NSwagStudioCodeGeneratorFactory(
     IGeneralOptions generalOptions,
     IProcessLauncher processLauncher,
     IDependencyInstaller dependencyInstaller)
 {
     this.generalOptions      = generalOptions ?? throw new ArgumentNullException(nameof(generalOptions));
     this.processLauncher     = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher));
     this.dependencyInstaller = dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller));
 }
コード例 #2
0
 public void Constructor_Requires_ProcessLauncher(IDependencyInstaller installer)
 => new Action(
     () => new SwaggerCSharpCodeGenerator(
         "",
         "",
         null,
         null,
         installer))
 .Should()
 .ThrowExactly <ArgumentNullException>();
コード例 #3
0
 public SwaggerSingleFileCustomTool(
     IGeneralOptions options,
     IProcessLauncher processLauncher,
     ISwaggerCodegenFactory factory,
     IDependencyInstaller dependencyInstaller)
 {
     this.options             = options ?? throw new ArgumentNullException(nameof(options));
     this.processLauncher     = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher));
     this.factory             = factory ?? throw new ArgumentNullException(nameof(factory));
     this.dependencyInstaller = dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller));
 }
コード例 #4
0
 public ICodeGenerator Create(
     string swaggerFile,
     string defaultNamespace,
     IGeneralOptions options,
     IProcessLauncher processLauncher,
     IDependencyInstaller dependencyInstaller)
 => new SwaggerCSharpCodeGenerator(
     swaggerFile,
     defaultNamespace,
     options,
     processLauncher,
     dependencyInstaller);
コード例 #5
0
 public SwaggerCodegenCommand(
     IConsoleOutput console,
     IProgressReporter progressReporter,
     IGeneralOptions options,
     IProcessLauncher processLauncher,
     ISwaggerCodegenFactory factory,
     IDependencyInstaller dependencyInstaller) : base(console, progressReporter)
 {
     this.options             = options ?? throw new ArgumentNullException(nameof(options));
     this.processLauncher     = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher));
     this.factory             = factory ?? throw new ArgumentNullException(nameof(factory));
     this.dependencyInstaller = dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller));
 }
コード例 #6
0
 public AutoRestSingleFileCustomTool(
     IAutoRestCodeGeneratorFactory factory,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IOpenApiDocumentFactory documentFactory,
     IDependencyInstaller dependencyInstaller)
 {
     this.factory             = factory ?? throw new ArgumentNullException(nameof(factory));
     this.options             = options ?? throw new ArgumentNullException(nameof(options));
     this.processLauncher     = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher));
     this.documentFactory     = documentFactory ?? throw new ArgumentNullException(nameof(documentFactory));
     this.dependencyInstaller = dependencyInstaller;
 }
コード例 #7
0
 public NSwagStudioCodeGenerator(
     string nswagStudioFile,
     IGeneralOptions options,
     IProcessLauncher processLauncher,
     IDependencyInstaller dependencyInstaller,
     bool forceDownload = false)
 {
     this.nswagStudioFile     = nswagStudioFile ?? throw new ArgumentNullException(nameof(nswagStudioFile));
     this.options             = options ?? throw new ArgumentNullException(nameof(options));
     this.processLauncher     = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher));
     this.dependencyInstaller = dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller));
     this.forceDownload       = forceDownload;
 }
コード例 #8
0
 public void Constructor_Requires_Options(
     IProcessLauncher launcher,
     IDependencyInstaller installer,
     IOpenApiGeneratorOptions openApiGeneratorOptions)
 => new Action(
     () => new OpenApiCSharpCodeGenerator(
         "",
         "",
         null,
         openApiGeneratorOptions,
         launcher,
         installer))
 .Should()
 .ThrowExactly <ArgumentNullException>();
コード例 #9
0
 public ICodeGenerator Create(
     string swaggerFile,
     string defaultNamespace,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IOpenApiDocumentFactory factory,
     IDependencyInstaller dependencyInstaller)
 => new AutoRestCSharpCodeGenerator(
     swaggerFile,
     defaultNamespace,
     options,
     processLauncher,
     factory,
     dependencyInstaller);
コード例 #10
0
 public SwaggerCSharpCodeGenerator(
     string swaggerFile,
     string defaultNamespace,
     IGeneralOptions options,
     IProcessLauncher processLauncher,
     IDependencyInstaller dependencyInstaller)
 {
     this.swaggerFile         = swaggerFile ?? throw new ArgumentNullException(nameof(swaggerFile));
     this.defaultNamespace    = defaultNamespace ?? throw new ArgumentNullException(nameof(defaultNamespace));
     this.options             = options ?? throw new ArgumentNullException(nameof(options));
     this.processLauncher     = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher));
     this.dependencyInstaller = dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller));
     javaPathProvider         = new JavaPathProvider(options, processLauncher);
 }
コード例 #11
0
 public void Reads_NSwagPath_From_Options(
     IProcessLauncher process,
     IGeneralOptions options,
     IProgressReporter progressReporter,
     IDependencyInstaller dependencyInstaller)
 {
     new NSwagStudioCodeGenerator(
         Path.GetFullPath(SwaggerNSwagFilename),
         options,
         process,
         dependencyInstaller,
         true)
     .GenerateCode(progressReporter);
     Mock.Get(options).Verify(c => c.NSwagPath);
 }
コード例 #12
0
 public void Create_Should_Return_NotNull(
     SwaggerCodegenFactory sut,
     string swaggerFile,
     string defaultNamespace,
     IGeneralOptions options,
     IProcessLauncher processLauncher,
     IDependencyInstaller dependencyInstaller)
 => sut.Create(
     swaggerFile,
     defaultNamespace,
     options,
     processLauncher,
     dependencyInstaller)
 .Should()
 .NotBeNull();
コード例 #13
0
 public OpenApiGeneratorCommand(
     IConsoleOutput console,
     IProgressReporter progressReporter,
     IGeneralOptions options,
     IOpenApiGeneratorOptions openApiGeneratorOptions,
     IProcessLauncher processLauncher,
     IOpenApiGeneratorFactory generatorFactory,
     IDependencyInstaller dependencyInstaller) : base(console, progressReporter)
 {
     this.options = options ?? throw new ArgumentNullException(nameof(options));
     this.openApiGeneratorOptions = openApiGeneratorOptions;
     this.processLauncher         = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher));
     this.generatorFactory        = generatorFactory ?? throw new ArgumentNullException(nameof(generatorFactory));
     this.dependencyInstaller     = dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller));
 }
コード例 #14
0
 public void NSwagStudio_GenerateCode_Returns_Null(
     IProcessLauncher process,
     IGeneralOptions options,
     IProgressReporter progressReporter,
     IDependencyInstaller dependencyInstaller)
 {
     new NSwagStudioCodeGenerator(
         Path.GetFullPath(SwaggerNSwagFilename),
         options,
         process,
         dependencyInstaller)
     .GenerateCode(progressReporter)
     .Should()
     .BeNull();
 }
コード例 #15
0
 public AutoRestCommand(
     IConsoleOutput console,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IProgressReporter progressReporter,
     IAutoRestCodeGeneratorFactory factory,
     IOpenApiDocumentFactory documentFactory,
     IDependencyInstaller dependencyInstaller) : base(console, progressReporter)
 {
     this.options             = options ?? throw new ArgumentNullException(nameof(options));
     this.processLauncher     = processLauncher ?? throw new ArgumentNullException(nameof(processLauncher));
     this.factory             = factory ?? throw new ArgumentNullException(nameof(factory));
     this.documentFactory     = documentFactory ?? throw new ArgumentNullException(nameof(documentFactory));
     this.dependencyInstaller = dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller));
 }
コード例 #16
0
 public AutoRestCSharpCodeGenerator(
     string swaggerFile,
     string defaultNamespace,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IOpenApiDocumentFactory documentFactory,
     IDependencyInstaller dependencyInstaller,
     IAutoRestArgumentProvider argumentProvider = null)
 {
     SwaggerFile              = swaggerFile;
     DefaultNamespace         = defaultNamespace;
     this.processLauncher     = processLauncher;
     this.documentFactory     = documentFactory ?? throw new ArgumentNullException(nameof(documentFactory));
     this.dependencyInstaller = dependencyInstaller ?? throw new ArgumentNullException(nameof(dependencyInstaller));
     this.argumentProvider    = argumentProvider ?? new AutoRestArgumentProvider(options);
 }
コード例 #17
0
 public CodeGeneratorFactory(
     IOptionsFactory optionsFactory          = null,
     IProcessLauncher processLauncher        = null,
     IOpenApiDocumentFactory documentFactory = null,
     IRemoteLogger remoteLogger = null,
     IDependencyInstaller dependencyInstaller = null)
 {
     this.remoteLogger        = remoteLogger ?? Logger.Instance;
     this.optionsFactory      = optionsFactory ?? new OptionsFactory();
     this.processLauncher     = processLauncher ?? new ProcessLauncher();
     this.documentFactory     = documentFactory ?? new OpenApiDocumentFactory();
     this.dependencyInstaller = dependencyInstaller ??
                                new DependencyInstaller(
         new NpmInstaller(this.processLauncher),
         new FileDownloader(new WebDownloader()));
 }
 public void Create_Should_Return_NotNull(
     AutoRestCodeGeneratorFactory sut,
     string swaggerFile,
     string defaultNamespace,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IOpenApiDocumentFactory documentFactory,
     IDependencyInstaller dependencyInstaller)
 => sut.Create(
     swaggerFile,
     defaultNamespace,
     options,
     processLauncher,
     documentFactory,
     dependencyInstaller)
 .Should()
 .NotBeNull();
コード例 #19
0
 public void Constructor_Should_Throw_On_Null_IAutoRestCodeGeneratorFactory(
     IConsoleOutput console,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IProgressReporter progressReporter,
     IOpenApiDocumentFactory documentFactory,
     IDependencyInstaller dependencyInstaller)
 => new Action(
     () => new AutoRestCommand(
         console,
         options,
         processLauncher,
         progressReporter,
         null,
         documentFactory,
         dependencyInstaller))
 .Should()
 .ThrowExactly <ArgumentNullException>();