コード例 #1
0
 public PythonCodeGenerator(Settings settings) : base(settings)
 {
     Namer = new PythonCodeNamer();
     this.packageVersion = Settings.PackageVersion;
 }
コード例 #2
0
ファイル: ExtensionsTests.cs プロジェクト: devigned/autorest
        public void TestClientNamePythonNormalization()
        {
            var setting = new Settings
            {
                Namespace = "Test",
                Input = Path.Combine("Swagger", "swagger-x-ms-client-name.json")
            };

            var modeler = new SwaggerModeler(setting);
            var clientModel = modeler.Build();
            SwaggerExtensions.NormalizeClientModel(clientModel, setting);
            var namer = new PythonCodeNamer();
            namer.NormalizeClientModel(clientModel);

            Assert.NotNull(clientModel);
            Assert.Equal(2, clientModel.Methods.Count);

            Assert.Equal(2, clientModel.Methods[0].Parameters.Where(p => !p.IsClientProperty).Count());

            Assert.Equal("subscription", clientModel.Methods[0].Parameters[0].GetClientName());
            Assert.Equal("version", clientModel.Methods[0].Parameters[1].GetClientName());
            Assert.Equal("subscription", clientModel.Methods[0].Parameters[0].Name);
            Assert.Equal("version", clientModel.Methods[0].Parameters[1].Name);

            Assert.Equal(2, clientModel.Properties.Count);
            Assert.Equal(0, clientModel.Methods[1].Parameters.Where(p => !p.IsClientProperty).Count());

            Assert.Equal("subscription", clientModel.Properties[0].GetClientName());
            Assert.Equal("_version", clientModel.Properties[1].GetClientName());
            Assert.Equal("subscription", clientModel.Properties[0].Name);
            Assert.Equal("_version", clientModel.Properties[1].Name);

            var type = clientModel.ModelTypes.First();

            Assert.Equal("error_code", type.Properties[0].Name);
            Assert.Equal("error_message", type.Properties[1].Name);
            Assert.Equal("parent_error", type.Properties[2].Name);
        }
コード例 #3
0
 public PythonCodeGenerator(Settings settings) : base(settings)
 {
     Namer = new PythonCodeNamer();
     this.packageVersion = Settings.PackageVersion;
 }