Beispiel #1
0
 public void CompositeModelWithEmptyDocuments()
 {
     Generator.Modeler modeler = new CompositeSwaggerModeler(new Settings
     {
         Namespace = "Test",
         Input     = Path.Combine("Swagger", "composite-swagger-empty.json")
     });
     Assert.Throws <CodeGenerationException>(() => modeler.Build());
 }
 public void CompositeModelWithEmptyInfo()
 {
     Modeler modeler = new CompositeSwaggerModeler(new Settings
     {
         Namespace = "Test",
         Input = Path.Combine("Swagger", "composite-swagger-empty2.json")
     });
     Assert.Throws<CodeGenerationException>(() => modeler.Build());
 }
 public void CompositeModelWithConflictInGlobalParam()
 {
     Modeler modeler = new CompositeSwaggerModeler(new Settings
     {
         Namespace = "Test",
         Input = Path.Combine("Swagger", "composite-swagger-conflict-in-global-param.json")
     });
     Assert.Throws<CodeGenerationException>(() => modeler.Build());
 }
Beispiel #4
0
 public void CompositeModelWithConflictInModel()
 {
     Generator.Modeler modeler = new CompositeSwaggerModeler(new Settings
     {
         Namespace = "Test",
         Input     = Path.Combine("Swagger", "composite-swagger-conflict-in-model.json")
     });
     Assert.Throws <CodeGenerationException>(() => modeler.Build());
 }
 public void CompositeModelWithEmptyInfo()
 {
     using (NewContext)
     {
         new Settings
         {
             Input = Path.Combine(Core.Utilities.Extensions.CodeBaseDirectory, "Resource", "Swagger", "composite-swagger-empty2.json")
         };
         Modeler modeler = new CompositeSwaggerModeler();
         Assert.Throws <CodeGenerationException>(() => modeler.Build());
     }
 }
 public void CompositeModelWithConflictInModel()
 {
     using (NewContext)
     {
         new Settings
         {
             Input = Path.Combine(Core.Utilities.Extensions.CodeBaseDirectory, "Resource", "Swagger", "composite-swagger-conflict-in-model.json")
         };
         Modeler modeler = new CompositeSwaggerModeler();
         Assert.Throws <Exception>(() => modeler.Build());
     }
 }
Beispiel #7
0
 public void CompositeModelWithConflictInModel()
 {
     using (NewContext)
     {
         new Settings
         {
             Namespace = "Test",
             Input     = Path.Combine("Swagger", "composite-swagger-conflict-in-model.json")
         };
         Modeler modeler = new CompositeSwaggerModeler();
         Assert.Throws <Exception>(() => modeler.Build());
     }
 }
Beispiel #8
0
 public void CompositeModelWithEmptyInfo()
 {
     using (NewContext)
     {
         new Settings
         {
             Namespace = "Test",
             Input     = Path.Combine("Swagger", "composite-swagger-empty2.json")
         };
         Modeler modeler = new CompositeSwaggerModeler();
         Assert.Throws <CodeGenerationException>(() => modeler.Build());
     }
 }
        public void CompositeSwaggerWithSameModels()
        {
            Modeler modeler = new CompositeSwaggerModeler(new Settings
            {
                Namespace = "Test",
                Input     = Path.Combine("Swagger", "composite-swagger-good3.json")
            });
            var clientModel = modeler.Build();

            Assert.Equal(2, clientModel.Methods.Count);
            Assert.Equal(2, clientModel.ModelTypes.Count);
            Assert.Equal(1, clientModel.MethodGroups.Count());
        }
        public void CompositeSwaggerWithOneModel()
        {
            Modeler modeler = new CompositeSwaggerModeler(new Settings
            {
                Namespace = "Test",
                Input = Path.Combine("Swagger", "composite-swagger-good2.json")
            });
            var clientModel = modeler.Build();

            Assert.Equal(2, clientModel.Methods.Count);
            Assert.Equal(2, clientModel.ModelTypes.Count);
            Assert.Equal(1, clientModel.MethodGroups.Count());
        }
        public void CompositeSwaggerWithTwoModels()
        {

            Generator.Modeler modeler = new CompositeSwaggerModeler(new Settings
            {
                Namespace = "Test",
                Input = Path.Combine("Swagger", "composite-swagger-good1.json")
            });
            var clientModel = modeler.Build();
            Assert.Equal("2014-04-01-preview", clientModel.Methods.FirstOrDefault(m => m.Name == "SimpleGet").Parameters.FirstOrDefault(p => p.SerializedName == "api-version").DefaultValue);
            Assert.Equal(true, clientModel.Methods.FirstOrDefault(m => m.Name == "SimpleGet").Parameters.FirstOrDefault(p => p.SerializedName == "api-version").IsConstant);
            Assert.Equal(5, clientModel.Methods.Count);
            Assert.Equal(3, clientModel.ModelTypes.Count);
            Assert.Equal(2, clientModel.MethodGroups.Count());
        }
        public void CompositeSwaggerWithTwoModels()
        {
            Modeler modeler = new CompositeSwaggerModeler(new Settings
            {
                Namespace = "Test",
                Input     = Path.Combine("Swagger", "composite-swagger-good1.json")
            });
            var clientModel = modeler.Build();

            Assert.Equal("2014-04-01-preview", clientModel.Methods.FirstOrDefault(m => m.Name == "SimpleGet").Parameters.FirstOrDefault(p => p.SerializedName == "api-version").DefaultValue);
            Assert.Equal(true, clientModel.Methods.FirstOrDefault(m => m.Name == "SimpleGet").Parameters.FirstOrDefault(p => p.SerializedName == "api-version").IsConstant);
            Assert.Equal(5, clientModel.Methods.Count);
            Assert.Equal(3, clientModel.ModelTypes.Count);
            Assert.Equal(2, clientModel.MethodGroups.Count());
        }
        public void CompositeSwaggerWithSameModels()
        {
            using (NewContext)
            {
                new Settings
                {
                    Input = Path.Combine(Core.Utilities.Extensions.CodeBaseDirectory, "Resource", "Swagger", "composite-swagger-good3.json")
                };
                Modeler modeler     = new CompositeSwaggerModeler();
                var     clientModel = modeler.Build();

                Assert.Equal(2, clientModel.Methods.Count);
                Assert.Equal(2, clientModel.ModelTypes.Count);
                Assert.Equal(1, clientModel.MethodGroupNames.Count());
            }
        }
Beispiel #14
0
        public void CompositeSwaggerWithOneModel()
        {
            using (NewContext)
            {
                new Settings
                {
                    Namespace = "Test",
                    Input     = Path.Combine("Swagger", "composite-swagger-good2.json")
                };
                Modeler modeler     = new CompositeSwaggerModeler();
                var     clientModel = modeler.Build();

                Assert.Equal(2, clientModel.Methods.Count);
                Assert.Equal(2, clientModel.ModelTypes.Count);
                Assert.Equal(1, clientModel.MethodGroupNames.Count());
            }
        }
        public void CompositeSwaggerWithSameModels()
        {

            using (NewContext)
            {
                new Settings
                {
                    Namespace = "Test",
                    Input = Path.Combine("Swagger", "composite-swagger-good3.json")
                };
                Modeler modeler = new CompositeSwaggerModeler();
                var clientModel = modeler.Build();

                Assert.Equal(2, clientModel.Methods.Count);
                Assert.Equal(2, clientModel.ModelTypes.Count);
                Assert.Equal(1, clientModel.MethodGroupNames.Count());
            }
        }
 public void CompositeSwaggerWithTwoModels()
 {
     using (NewContext)
     {
         new Settings
         {
             Input = Path.Combine(Core.Utilities.Extensions.CodeBaseDirectory, "Resource", "Swagger", "composite-swagger-good1.json")
         };
         Modeler modeler     = new CompositeSwaggerModeler();
         var     clientModel = modeler.Build();
         Assert.Equal("2014-04-01-preview",
                      clientModel.Methods.FirstOrDefault(m => m.Name == "SimpleGet")
                      .Parameters.FirstOrDefault(p => p.SerializedName == "api-version")
                      .DefaultValue);
         Assert.Equal(true,
                      clientModel.Methods.FirstOrDefault(m => m.Name == "SimpleGet")
                      .Parameters.FirstOrDefault(p => p.SerializedName == "api-version")
                      .IsConstant);
         Assert.Equal(5, clientModel.Methods.Count);
         Assert.Equal(3, clientModel.ModelTypes.Count);
         Assert.Equal(2, clientModel.MethodGroupNames.Count());
     }
 }
 public void CompositeModelWithConflictInModel()
 {
     using (NewContext)
     {
         new Settings
         {
             Namespace = "Test",
             Input = Path.Combine("Swagger", "composite-swagger-conflict-in-model.json")
         };
         Modeler modeler = new CompositeSwaggerModeler();
         Assert.Throws<CodeGenerationException>(() => modeler.Build());
     }
 }