Пример #1
0
 public AutoRestCSharpCodeGenerator(
     string swaggerFile,
     string defaultNamespace,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IOpenApiDocumentFactory documentFactory)
     : base(swaggerFile, defaultNamespace, processLauncher)
 {
     this.options         = options ?? throw new ArgumentNullException(nameof(options));
     this.documentFactory = documentFactory ?? throw new ArgumentNullException(nameof(documentFactory));
 }
Пример #2
0
 public ICodeGenerator Create(
     string swaggerFile,
     string defaultNamespace,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IOpenApiDocumentFactory documentFactory)
 => new AutoRestCSharpCodeGenerator(
     swaggerFile,
     defaultNamespace,
     options,
     processLauncher,
     documentFactory);
 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;
 }
 public AutoRestCommand(
     IConsoleOutput console,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IProgressReporter progressReporter,
     IAutoRestCodeGeneratorFactory factory,
     IOpenApiDocumentFactory documentFactory) : 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));
 }
Пример #5
0
 public void Create_Should_Return_NotNull(
     AutoRestCodeGeneratorFactory sut,
     string swaggerFile,
     string defaultNamespace,
     IAutoRestOptions options,
     IProcessLauncher processLauncher)
 => sut.Create(
     swaggerFile,
     defaultNamespace,
     options,
     processLauncher)
 .Should()
 .NotBeNull();
Пример #6
0
 public ICodeGenerator Create(
     string swaggerFile,
     string defaultNamespace,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IOpenApiDocumentFactory factory,
     IDependencyInstaller dependencyInstaller)
 => new AutoRestCSharpCodeGenerator(
     swaggerFile,
     defaultNamespace,
     options,
     processLauncher,
     factory,
     dependencyInstaller);
 public void Constructor_Should_Throw_On_Null_IAutoRestCodeGeneratorFactory(
     IConsoleOutput console,
     IAutoRestOptions options,
     IProcessLauncher processLauncher,
     IProgressReporter progressReporter,
     IOpenApiDocumentFactory documentFactory)
 => new Action(
     () => new AutoRestCommand(
         console,
         options,
         processLauncher,
         progressReporter,
         null,
         documentFactory))
 .Should()
 .ThrowExactly <ArgumentNullException>();
Пример #8
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);
 }
 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();
Пример #10
0
        public void OnExecuteAsync_Should_NotThrow(
            IConsoleOutput console,
            IAutoRestOptions options,
            IProcessLauncher processLauncher,
            IProgressReporter progressReporter,
            IAutoRestCodeGeneratorFactory factory,
            ICodeGenerator generator,
            string outputFile,
            string code)
        {
            var sut = new AutoRestCommand(
                console,
                options,
                processLauncher,
                progressReporter,
                factory)
            {
                OutputFile = outputFile
            };

            Mock.Get(generator).Setup(c => c.GenerateCode(progressReporter)).Returns(code);
            new Func <Task>(sut.OnExecuteAsync).Should().NotThrow();
        }
Пример #11
0
 public void Init()
 => options = new Mock <IAutoRestOptions>().Object;
Пример #12
0
 public AutoRestArgumentProvider(IAutoRestOptions options)
 {
     this.options = options;
 }