Example #1
0
 public void Reads_SwaggerCodegenPath(
     [Frozen] IGeneralOptions options,
     IProgressReporter progressReporter,
     OpenApiCSharpCodeGenerator sut)
 {
     sut.GenerateCode(progressReporter);
     Mock.Get(options).Verify(c => c.OpenApiGeneratorPath);
 }
Example #2
0
 public void Updates_Progress(
     [Frozen] IProgressReporter progressReporter,
     OpenApiCSharpCodeGenerator sut)
 {
     sut.GenerateCode(progressReporter);
     Mock.Get(progressReporter)
     .Verify(
         c => c.Progress(
             It.IsAny <uint>(),
             It.IsAny <uint>()),
         Times.Exactly(5));
 }
Example #3
0
        public static void Init(TestContext testContext)
        {
            optionsMock = new Mock <IGeneralOptions>();
            optionsMock.Setup(c => c.NSwagPath).Returns(PathProvider.GetJavaPath());

            var codeGenerator = new OpenApiCSharpCodeGenerator(
                Path.GetFullPath("Swagger.json"),
                typeof(OpenApiCodeGeneratorTests).Namespace,
                optionsMock.Object);

            code = codeGenerator.GenerateCode(mock.Object);
        }
        public OpenApiCodeGeneratorFixture()
        {
            OptionsMock = new Mock <IGeneralOptions>();
            OptionsMock.Setup(c => c.NSwagPath).Returns(PathProvider.GetJavaPath());

            var codeGenerator = new OpenApiCSharpCodeGenerator(
                Path.GetFullPath("Swagger_v3.yaml"),
                typeof(OpenApiCodeGeneratorYamlTests).Namespace,
                OptionsMock.Object,
                new ProcessLauncher());

            Code = codeGenerator.GenerateCode(ProgressReporterMock.Object);
        }
        protected override void OnInitialize()
        {
            ThrowNotSupportedOnUnix();

            OptionsMock.Setup(c => c.JavaPath).Returns(PathProvider.GetJavaPath());

            var codeGenerator = new OpenApiCSharpCodeGenerator(
                Path.GetFullPath(SwaggerJsonFilename),
                "GeneratedCode",
                OptionsMock.Object,
                new ProcessLauncher());

            Code = codeGenerator.GenerateCode(ProgressReporterMock.Object);
        }
Example #6
0
        // [ClassInitialize]
        public static async Task InitAsync(/* TestContext testContext */)
        {
            optionsMock = new Mock <IGeneralOptions>();
            optionsMock.Setup(c => c.NSwagPath).Returns(PathProvider.GetJavaPath());

            var codeGenerator = new OpenApiCSharpCodeGenerator(
                Path.GetFullPath(SwaggerJsonFilename),
                "GeneratedCode",
                optionsMock.Object);

            var options = new CodeWithOptions(codeGenerator.GenerateCode(mock.Object));
            var result  = await CodeConverter.Convert(options);

            code = result.ConvertedCode;
        }
Example #7
0
        public static async Task InitAsync(TestContext testContext)
        {
            optionsMock = new Mock <IGeneralOptions>();
            optionsMock.Setup(c => c.NSwagPath).Returns(PathProvider.GetJavaPath());

            var codeGenerator = new OpenApiCSharpCodeGenerator(
                Path.GetFullPath("Swagger.json"),
                typeof(OpenApiVisualBasicCodeGeneratorTests).Namespace,
                optionsMock.Object);

            var options = new CodeWithOptions(codeGenerator.GenerateCode(mock.Object));
            var result  = await CodeConverter.Convert(options);

            code = result.ConvertedCode;
        }
Example #8
0
        protected override void OnInitialize()
        {
            ThrowNotSupportedOnUnix();

            OptionsMock.Setup(c => c.NSwagPath).Returns(PathProvider.GetJavaPath());

            var codeGenerator = new OpenApiCSharpCodeGenerator(
                Path.GetFullPath(SwaggerV3YamlFilename),
                "GeneratedCode",
                OptionsMock.Object,
                new DefaultOpenApiGeneratorOptions(),
                new ProcessLauncher(),
                new DependencyInstaller(
                    new NpmInstaller(new ProcessLauncher()),
                    new FileDownloader(new WebDownloader())));

            Code = codeGenerator.GenerateCode(ProgressReporterMock.Object);
        }