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

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

            code = codeGenerator.GenerateCode(mock.Object);
        }
Exemple #4
0
        // [ClassInitialize]
        public static void Init(/* TestContext testContext */)
        {
            optionsMock = new Mock <IGeneralOptions>();
            optionsMock.Setup(c => c.NSwagPath).Returns(PathProvider.GetJavaPath());

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

            code = codeGenerator.GenerateCode(mock.Object);
        }
Exemple #5
0
        public SwaggerCodeGeneratorFixture()
        {
            OptionsMock.Setup(c => c.NSwagPath).Returns(PathProvider.GetJavaPath());

            var codeGenerator = new SwaggerCSharpCodeGenerator(
                Path.GetFullPath("Swagger.json"),
                typeof(SwaggerCodeGeneratorTests).Namespace,
                OptionsMock.Object,
                new ProcessLauncher());

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

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

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

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

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

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

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