From 373e5fbde23c4965dbb0016a428af9cfc2cbb9d1 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 16 May 2016 16:35:25 +0800 Subject: [PATCH] fix indention in tostring and constructor, add existing test cases to auto-generated test files --- .../main/resources/csharp/api_test.mustache | 2 +- .../resources/csharp/modelGeneric.mustache | 22 +- .../csharp/SwaggerClient/IO.Swagger.sln | 10 +- .../petstore/csharp/SwaggerClient/README.md | 2 +- .../src/IO.Swagger.Test/Api/FakeApiTests.cs | 20 +- .../src/IO.Swagger.Test/Api/PetApiTests.cs | 240 +++++++++++++++--- .../src/IO.Swagger.Test/Api/StoreApiTests.cs | 62 ++++- .../src/IO.Swagger.Test/Api/UserApiTests.cs | 38 +-- .../IO.Swagger.Test/Client/ApiClientTests.cs | 149 +++++++++++ .../Client/ConfigurationTests.cs | 129 ++++++++++ .../IO.Swagger.Test/IO.Swagger.Test.csproj | 47 ++-- .../src/IO.Swagger.Test/Model/AnimalTests.cs | 2 +- .../src/IO.Swagger.Test/Model/CatTests.cs | 2 +- .../src/IO.Swagger.Test/Model/DogTests.cs | 2 +- .../IO.Swagger.Test/Model/EnumClassTests.cs | 16 ++ .../IO.Swagger.Test/Model/FormatTestTests.cs | 2 +- .../src/IO.Swagger.Test/Model/NameTests.cs | 2 +- .../src/IO.Swagger.Test/Model/OrderTests.cs | 10 + .../src/IO.Swagger.Test/Model/PetTests.cs | 67 ++++- .../src/IO.Swagger.Test/swagger-logo.png | Bin 0 -> 11917 bytes .../src/IO.Swagger/IO.Swagger.csproj | 2 +- .../src/IO.Swagger/Model/Animal.cs | 5 +- .../src/IO.Swagger/Model/AnimalFarm.cs | 4 +- .../src/IO.Swagger/Model/ApiResponse.cs | 15 +- .../SwaggerClient/src/IO.Swagger/Model/Cat.cs | 10 +- .../src/IO.Swagger/Model/Category.cs | 10 +- .../SwaggerClient/src/IO.Swagger/Model/Dog.cs | 10 +- .../src/IO.Swagger/Model/EnumTest.cs | 15 +- .../src/IO.Swagger/Model/FormatTest.cs | 53 ++-- .../src/IO.Swagger/Model/Model200Response.cs | 5 +- .../src/IO.Swagger/Model/ModelReturn.cs | 5 +- .../src/IO.Swagger/Model/Name.cs | 11 +- .../src/IO.Swagger/Model/Order.cs | 28 +- .../SwaggerClient/src/IO.Swagger/Model/Pet.cs | 24 +- .../src/IO.Swagger/Model/SpecialModelName.cs | 5 +- .../SwaggerClient/src/IO.Swagger/Model/Tag.cs | 10 +- .../src/IO.Swagger/Model/User.cs | 40 ++- 37 files changed, 797 insertions(+), 279 deletions(-) create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs create mode 100644 samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/swagger-logo.png diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache index cb345a93cc4..21471de3c27 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache @@ -32,7 +32,7 @@ namespace {{packageName}}.Test [SetUp] public void Init() { - instance = new {{classname}}(); + instance = new {{classname}}(); } /// diff --git a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache index 7535af0a3d8..acc3675f10c 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache @@ -41,7 +41,10 @@ {{/vars}} public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}}) { - {{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null) + {{#vars}} + {{^isReadOnly}} + {{#required}} + // to ensure "{{name}}" is required (not null) if ({{name}} == null) { throw new InvalidDataException("{{name}} is a required property for {{classname}} and cannot be null"); @@ -50,8 +53,12 @@ { this.{{name}} = {{name}}; } - {{/required}}{{/isReadOnly}}{{/vars}} - {{#vars}}{{^isReadOnly}}{{^required}} + {{/required}} + {{/isReadOnly}} + {{/vars}} + {{#vars}} + {{^isReadOnly}} + {{^required}} {{#defaultValue}}// use default value if no "{{name}}" provided if ({{name}} == null) { @@ -63,9 +70,11 @@ } {{/defaultValue}} {{^defaultValue}} - this.{{name}} = {{name}}; +this.{{name}} = {{name}}; {{/defaultValue}} - {{/required}}{{/isReadOnly}}{{/vars}} + {{/required}} + {{/isReadOnly}} + {{/vars}} } {{#vars}} @@ -86,7 +95,8 @@ { var sb = new StringBuilder(); sb.Append("class {{classname}} {\n"); - {{#vars}}sb.Append(" {{name}}: ").Append({{name}}).Append("\n"); + {{#vars}} + sb.Append(" {{name}}: ").Append({{name}}).Append("\n"); {{/vars}} sb.Append("}\n"); return sb.ToString(); diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index 1088cf28dc3..cdf88075dfa 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{74456AF8-75EE-4ABC-97EB-CA96A472DD21}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{74456AF8-75EE-4ABC-97EB-CA96A472DD21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{74456AF8-75EE-4ABC-97EB-CA96A472DD21}.Debug|Any CPU.Build.0 = Debug|Any CPU -{74456AF8-75EE-4ABC-97EB-CA96A472DD21}.Release|Any CPU.ActiveCfg = Release|Any CPU -{74456AF8-75EE-4ABC-97EB-CA96A472DD21}.Release|Any CPU.Build.0 = Release|Any CPU +{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Debug|Any CPU.Build.0 = Debug|Any CPU +{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Release|Any CPU.ActiveCfg = Release|Any CPU +{1293D07E-F404-42B9-8BC7-0A4DAD18E83B}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index fbeb46025d0..a929fbd5db6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2016-05-13T21:50:05.372+08:00 +- Build date: 2016-05-16T15:24:50.194+08:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs index 478311b649e..71a4063af4e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs @@ -58,20 +58,22 @@ namespace IO.Swagger.Test [Test] public void TestEndpointParametersTest() { + /* comment out the following as the endpiont is fake // TODO: add unit test for the method 'TestEndpointParameters' - double? number = null; // TODO: replace null with proper value - double? _double = null; // TODO: replace null with proper value - string _string = null; // TODO: replace null with proper value - byte[] _byte = null; // TODO: replace null with proper value - int? integer = null; // TODO: replace null with proper value - int? int32 = null; // TODO: replace null with proper value - long? int64 = null; // TODO: replace null with proper value - float? _float = null; // TODO: replace null with proper value + double? number = 12.3; // TODO: replace null with proper value + double? _double = 34.5; // TODO: replace null with proper value + string _string = "charp test"; // TODO: replace null with proper value + byte[] _byte = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };; // TODO: replace null with proper value + int? integer = 3; // TODO: replace null with proper value + int? int32 = 2; // TODO: replace null with proper value + long? int64 = 1; // TODO: replace null with proper value + float? _float = 7.8F; // TODO: replace null with proper value byte[] binary = null; // TODO: replace null with proper value - DateTime? date = null; // TODO: replace null with proper value + DateTime? date = null; // TODO: replace null with proper value DateTime? dateTime = null; // TODO: replace null with proper value string password = null; // TODO: replace null with proper value instance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + */ } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs index a24e297eea1..b9dae814b68 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs @@ -25,13 +25,59 @@ namespace IO.Swagger.Test { private PetApi instance; + private long petId = 11088; + + /// + /// Create a Pet object + /// + private Pet createPet() + { + // create pet + Pet p = new Pet(Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" }); + p.Id = petId; + //p.Name = "Csharp test"; + p.Status = Pet.StatusEnum.Available; + // create Category object + Category category = new Category(); + category.Id = 56; + category.Name = "sample category name2"; + List photoUrls = new List(new String[] {"sample photoUrls"}); + // create Tag object + Tag tag = new Tag(); + tag.Id = petId; + tag.Name = "csharp sample tag name1"; + List tags = new List(new Tag[] {tag}); + p.Tags = tags; + p.Category = category; + p.PhotoUrls = photoUrls; + + return p; + } + + /// + /// Convert string to byte array + /// + private byte[] GetBytes(string str) + { + byte[] bytes = new byte[str.Length * sizeof(char)]; + System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length); + return bytes; + } + /// /// Setup before each unit test /// [SetUp] public void Init() { - instance = new PetApi(); + instance = new PetApi(); + + // create pet + Pet p = createPet(); + + // add pet before testing + PetApi petApi = new PetApi("http://petstore.swagger.io/v2/"); + petApi.AddPet (p); } /// @@ -40,7 +86,9 @@ namespace IO.Swagger.Test [TearDown] public void Cleanup() { - + // remove the pet after testing + PetApi petApi = new PetApi (); + petApi.DeletePet(petId, "test key"); } /// @@ -59,10 +107,10 @@ namespace IO.Swagger.Test [Test] public void AddPetTest() { - // TODO: add unit test for the method 'AddPet' - Pet body = null; // TODO: replace null with proper value - instance.AddPet(body); - + // create pet + Pet p = createPet(); + + instance.AddPet(p); } /// @@ -71,11 +119,7 @@ namespace IO.Swagger.Test [Test] public void DeletePetTest() { - // TODO: add unit test for the method 'DeletePet' - long? petId = null; // TODO: replace null with proper value - string apiKey = null; // TODO: replace null with proper value - instance.DeletePet(petId, apiKey); - + // no need to test as it'c covered by Cleanup() already } /// @@ -84,10 +128,15 @@ namespace IO.Swagger.Test [Test] public void FindPetsByStatusTest() { - // TODO: add unit test for the method 'FindPetsByStatus' - List status = null; // TODO: replace null with proper value - var response = instance.FindPetsByStatus(status); - Assert.IsInstanceOf> (response, "response is List"); + PetApi petApi = new PetApi (); + List tagsList = new List(new String[] {"available"}); + + List listPet = petApi.FindPetsByTags (tagsList); + foreach (Pet pet in listPet) // Loop through List with foreach. + { + Assert.IsInstanceOf (pet, "Response is a Pet"); + Assert.AreEqual ("csharp sample tag name1", pet.Tags[0]); + } } /// @@ -96,8 +145,7 @@ namespace IO.Swagger.Test [Test] public void FindPetsByTagsTest() { - // TODO: add unit test for the method 'FindPetsByTags' - List tags = null; // TODO: replace null with proper value + List tags = new List(new String[] {"pet"}); var response = instance.FindPetsByTags(tags); Assert.IsInstanceOf> (response, "response is List"); } @@ -108,22 +156,96 @@ namespace IO.Swagger.Test [Test] public void GetPetByIdTest() { - // TODO: add unit test for the method 'GetPetById' - long? petId = null; // TODO: replace null with proper value - var response = instance.GetPetById(petId); - Assert.IsInstanceOf (response, "response is Pet"); + // set timeout to 10 seconds + Configuration c1 = new Configuration (timeout: 10000, userAgent: "TEST_USER_AGENT"); + + PetApi petApi = new PetApi (c1); + Pet response = petApi.GetPetById (petId); + Assert.IsInstanceOf (response, "Response is a Pet"); + + Assert.AreEqual ("Csharp test", response.Name); + Assert.AreEqual (Pet.StatusEnum.Available, response.Status); + + Assert.IsInstanceOf> (response.Tags, "Response.Tags is a Array"); + Assert.AreEqual (petId, response.Tags [0].Id); + Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); + + Assert.IsInstanceOf> (response.PhotoUrls, "Response.PhotoUrls is a Array"); + Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); + + Assert.IsInstanceOf (response.Category, "Response.Category is a Category"); + Assert.AreEqual (56, response.Category.Id); + Assert.AreEqual ("sample category name2", response.Category.Name); } + + /// + /// Test GetPetByIdAsync + /// + [Test ()] + public void TestGetPetByIdAsync () + { + PetApi petApi = new PetApi (); + var task = petApi.GetPetByIdAsync (petId); + Pet response = task.Result; + Assert.IsInstanceOf (response, "Response is a Pet"); + + Assert.AreEqual ("Csharp test", response.Name); + Assert.AreEqual (Pet.StatusEnum.Available, response.Status); + + Assert.IsInstanceOf> (response.Tags, "Response.Tags is a Array"); + Assert.AreEqual (petId, response.Tags [0].Id); + Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); + + Assert.IsInstanceOf> (response.PhotoUrls, "Response.PhotoUrls is a Array"); + Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); + + Assert.IsInstanceOf (response.Category, "Response.Category is a Category"); + Assert.AreEqual (56, response.Category.Id); + Assert.AreEqual ("sample category name2", response.Category.Name); + + } + /// + /// Test GetPetByIdAsyncWithHttpInfo + /// + [Test ()] + public void TestGetPetByIdAsyncWithHttpInfo () + { + PetApi petApi = new PetApi (); + var task = petApi.GetPetByIdAsyncWithHttpInfo (petId); + + Assert.AreEqual (200, task.Result.StatusCode); + Assert.IsTrue (task.Result.Headers.ContainsKey("Content-Type")); + Assert.AreEqual (task.Result.Headers["Content-Type"], "application/json"); + + Pet response = task.Result.Data; + Assert.IsInstanceOf (response, "Response is a Pet"); + + Assert.AreEqual ("Csharp test", response.Name); + Assert.AreEqual (Pet.StatusEnum.Available, response.Status); + + Assert.IsInstanceOf> (response.Tags, "Response.Tags is a Array"); + Assert.AreEqual (petId, response.Tags [0].Id); + Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); + + Assert.IsInstanceOf> (response.PhotoUrls, "Response.PhotoUrls is a Array"); + Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); + + Assert.IsInstanceOf (response.Category, "Response.Category is a Category"); + Assert.AreEqual (56, response.Category.Id); + Assert.AreEqual ("sample category name2", response.Category.Name); + + } + /// /// Test UpdatePet /// [Test] public void UpdatePetTest() { - // TODO: add unit test for the method 'UpdatePet' - Pet body = null; // TODO: replace null with proper value - instance.UpdatePet(body); - + // create pet + Pet p = createPet(); + instance.UpdatePet(p); } /// @@ -132,12 +254,24 @@ namespace IO.Swagger.Test [Test] public void UpdatePetWithFormTest() { - // TODO: add unit test for the method 'UpdatePetWithForm' - long? petId = null; // TODO: replace null with proper value - string name = null; // TODO: replace null with proper value - string status = null; // TODO: replace null with proper value - instance.UpdatePetWithForm(petId, name, status); - + PetApi petApi = new PetApi (); + petApi.UpdatePetWithForm (petId, "new form name", "pending"); + + Pet response = petApi.GetPetById (petId); + Assert.IsInstanceOf (response, "Response is a Pet"); + Assert.IsInstanceOf (response.Category, "Response.Category is a Category"); + Assert.IsInstanceOf> (response.Tags, "Response.Tags is a Array"); + + Assert.AreEqual ("new form name", response.Name); + Assert.AreEqual (Pet.StatusEnum.Pending, response.Status); + + Assert.AreEqual (petId, response.Tags [0].Id); + Assert.AreEqual (56, response.Category.Id); + + // test optional parameter + petApi.UpdatePetWithForm (petId, "new form name2"); + Pet response2 = petApi.GetPetById (petId); + Assert.AreEqual ("new form name2", response2.Name); } /// @@ -146,13 +280,45 @@ namespace IO.Swagger.Test [Test] public void UploadFileTest() { - // TODO: add unit test for the method 'UploadFile' - long? petId = null; // TODO: replace null with proper value - string additionalMetadata = null; // TODO: replace null with proper value - System.IO.Stream file = null; // TODO: replace null with proper value - var response = instance.UploadFile(petId, additionalMetadata, file); - Assert.IsInstanceOf (response, "response is ApiResponse"); + Assembly _assembly = Assembly.GetExecutingAssembly(); + Stream _imageStream = _assembly.GetManifestResourceStream("IO.Swagger.Test.swagger-logo.png"); + PetApi petApi = new PetApi (); + // test file upload with form parameters + petApi.UploadFile(petId, "new form name", _imageStream); + + // test file upload without any form parameters + // using optional parameter syntax introduced at .net 4.0 + petApi.UploadFile(petId: petId, file: _imageStream); + } + + /// + /// Test status code + /// + [Test ()] + public void TestStatusCodeAndHeader () + { + PetApi petApi = new PetApi (); + var response = petApi.GetPetByIdWithHttpInfo (petId); + Assert.AreEqual (response.StatusCode, 200); + Assert.IsTrue (response.Headers.ContainsKey("Content-Type")); + Assert.AreEqual (response.Headers["Content-Type"], "application/json"); + } + + /// + /// Test default header (should be deprecated + /// + [Test ()] + public void TestDefaultHeader () + { + PetApi petApi = new PetApi (); + // commented out the warning test below as it's confirmed the warning is working as expected + // there should be a warning for using AddDefaultHeader (deprecated) below + //petApi.AddDefaultHeader ("header_key", "header_value"); + // the following should be used instead as suggested in the doc + petApi.Configuration.AddDefaultHeader ("header_key2", "header_value2"); + + } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs index 5ccac40bbfb..e1237b51c0b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Reflection; using RestSharp; using NUnit.Framework; +using Newtonsoft.Json; using IO.Swagger.Client; using IO.Swagger.Api; @@ -60,8 +61,8 @@ namespace IO.Swagger.Test public void DeleteOrderTest() { // TODO: add unit test for the method 'DeleteOrder' - string orderId = null; // TODO: replace null with proper value - instance.DeleteOrder(orderId); + //string orderId = null; // TODO: replace null with proper value + //instance.DeleteOrder(orderId); } @@ -72,8 +73,19 @@ namespace IO.Swagger.Test public void GetInventoryTest() { // TODO: add unit test for the method 'GetInventory' - var response = instance.GetInventory(); - Assert.IsInstanceOf> (response, "response is Dictionary"); + //var response = instance.GetInventory(); + //Assert.IsInstanceOf> (response, "response is Dictionary"); + + // set timeout to 10 seconds + Configuration c1 = new Configuration (timeout: 10000); + + StoreApi storeApi = new StoreApi (c1); + Dictionary response = storeApi.GetInventory (); + + foreach(KeyValuePair entry in response) + { + Assert.IsInstanceOf (typeof(int?), entry.Value); + } } /// @@ -83,9 +95,9 @@ namespace IO.Swagger.Test public void GetOrderByIdTest() { // TODO: add unit test for the method 'GetOrderById' - long? orderId = null; // TODO: replace null with proper value - var response = instance.GetOrderById(orderId); - Assert.IsInstanceOf (response, "response is Order"); + //long? orderId = null; // TODO: replace null with proper value + //var response = instance.GetOrderById(orderId); + //Assert.IsInstanceOf (response, "response is Order"); } /// @@ -95,11 +107,41 @@ namespace IO.Swagger.Test public void PlaceOrderTest() { // TODO: add unit test for the method 'PlaceOrder' - Order body = null; // TODO: replace null with proper value - var response = instance.PlaceOrder(body); - Assert.IsInstanceOf (response, "response is Order"); + //Order body = null; // TODO: replace null with proper value + //var response = instance.PlaceOrder(body); + //Assert.IsInstanceOf (response, "response is Order"); } + /// + /// Test Enum + /// + [Test ()] + public void TestEnum () + { + Assert.AreEqual (Order.StatusEnum.Approved.ToString(), "Approved"); + } + + /// + /// Test deserialization of JSON to Order and its readonly property + /// + [Test ()] + public void TesOrderDeserialization() + { + string json = @"{ +'id': 1982, +'petId': 1020, +'quantity': 1, +'status': 'placed', +'complete': true, +}"; + var o = JsonConvert.DeserializeObject(json); + Assert.AreEqual (1982, o.Id); + Assert.AreEqual (1020, o.PetId); + Assert.AreEqual (1, o.Quantity); + Assert.AreEqual (Order.StatusEnum.Placed, o.Status); + Assert.AreEqual (true, o.Complete); + + } } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs index ffb0593aa88..77f6bd5ec99 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs @@ -60,8 +60,8 @@ namespace IO.Swagger.Test public void CreateUserTest() { // TODO: add unit test for the method 'CreateUser' - User body = null; // TODO: replace null with proper value - instance.CreateUser(body); + //User body = null; // TODO: replace null with proper value + //instance.CreateUser(body); } @@ -72,8 +72,8 @@ namespace IO.Swagger.Test public void CreateUsersWithArrayInputTest() { // TODO: add unit test for the method 'CreateUsersWithArrayInput' - List body = null; // TODO: replace null with proper value - instance.CreateUsersWithArrayInput(body); + //List body = null; // TODO: replace null with proper value + //instance.CreateUsersWithArrayInput(body); } @@ -84,8 +84,8 @@ namespace IO.Swagger.Test public void CreateUsersWithListInputTest() { // TODO: add unit test for the method 'CreateUsersWithListInput' - List body = null; // TODO: replace null with proper value - instance.CreateUsersWithListInput(body); + //List body = null; // TODO: replace null with proper value + //instance.CreateUsersWithListInput(body); } @@ -96,8 +96,8 @@ namespace IO.Swagger.Test public void DeleteUserTest() { // TODO: add unit test for the method 'DeleteUser' - string username = null; // TODO: replace null with proper value - instance.DeleteUser(username); + //string username = null; // TODO: replace null with proper value + //instance.DeleteUser(username); } @@ -108,9 +108,9 @@ namespace IO.Swagger.Test public void GetUserByNameTest() { // TODO: add unit test for the method 'GetUserByName' - string username = null; // TODO: replace null with proper value - var response = instance.GetUserByName(username); - Assert.IsInstanceOf (response, "response is User"); + //string username = null; // TODO: replace null with proper value + //var response = instance.GetUserByName(username); + //Assert.IsInstanceOf (response, "response is User"); } /// @@ -120,10 +120,10 @@ namespace IO.Swagger.Test public void LoginUserTest() { // TODO: add unit test for the method 'LoginUser' - string username = null; // TODO: replace null with proper value - string password = null; // TODO: replace null with proper value - var response = instance.LoginUser(username, password); - Assert.IsInstanceOf (response, "response is string"); + //string username = null; // TODO: replace null with proper value + //string password = null; // TODO: replace null with proper value + //var response = instance.LoginUser(username, password); + //Assert.IsInstanceOf (response, "response is string"); } /// @@ -133,7 +133,7 @@ namespace IO.Swagger.Test public void LogoutUserTest() { // TODO: add unit test for the method 'LogoutUser' - instance.LogoutUser(); + //instance.LogoutUser(); } @@ -144,9 +144,9 @@ namespace IO.Swagger.Test public void UpdateUserTest() { // TODO: add unit test for the method 'UpdateUser' - string username = null; // TODO: replace null with proper value - User body = null; // TODO: replace null with proper value - instance.UpdateUser(username, body); + //string username = null; // TODO: replace null with proper value + //User body = null; // TODO: replace null with proper value + //instance.UpdateUser(username, body); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs new file mode 100644 index 00000000000..4f31bc0b302 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs @@ -0,0 +1,149 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using IO.Swagger.Client; +using IO.Swagger.Api; +using IO.Swagger.Model; + +namespace IO.Swagger.Test +{ + public class ApiClientTests + { + public ApiClientTests () + { + } + + [TearDown()] + public void TearDown() + { + // Reset to default, just in case + Configuration.Default.DateTimeFormat = "o"; + } + + /// + /// Test SelectHeaderContentType + /// + [Test ()] + public void TestSelectHeaderContentType () + { + ApiClient api = new ApiClient (); + String[] contentTypes = new String[] { "application/json", "application/xml" }; + Assert.AreEqual("application/json", api.SelectHeaderContentType (contentTypes)); + + contentTypes = new String[] { "application/xml" }; + Assert.AreEqual("application/xml", api.SelectHeaderContentType (contentTypes)); + + contentTypes = new String[] {}; + Assert.IsNull(api.SelectHeaderContentType (contentTypes)); + } + + /// + /// Test ParameterToString + /// + [Test ()] + public void TestParameterToString () + { + ApiClient api = new ApiClient (); + + // test array of string + List statusList = new List(new String[] {"available", "sold"}); + Assert.AreEqual("available,sold", api.ParameterToString (statusList)); + + // test array of int + List numList = new List(new int[] {1, 37}); + Assert.AreEqual("1,37", api.ParameterToString (numList)); + } + + [Test ()] + public void TestParameterToStringForDateTime () + { + ApiClient api = new ApiClient (); + + // test datetime + DateTime dateUtc = DateTime.Parse ("2008-04-10T13:30:00.0000000z", null, System.Globalization.DateTimeStyles.RoundtripKind); + Assert.AreEqual ("2008-04-10T13:30:00.0000000Z", api.ParameterToString (dateUtc)); + + // test datetime with no timezone + DateTime dateWithNoTz = DateTime.Parse ("2008-04-10T13:30:00.000", null, System.Globalization.DateTimeStyles.RoundtripKind); + Assert.AreEqual ("2008-04-10T13:30:00.0000000", api.ParameterToString (dateWithNoTz)); + } + + // The test below only passes when running at -04:00 timezone + [Ignore ()] + public void TestParameterToStringWithTimeZoneForDateTime () + { + ApiClient api = new ApiClient (); + // test datetime with a time zone + DateTimeOffset dateWithTz = DateTimeOffset.Parse("2008-04-10T13:30:00.0000000-04:00", null, System.Globalization.DateTimeStyles.RoundtripKind); + Assert.AreEqual("2008-04-10T13:30:00.0000000-04:00", api.ParameterToString(dateWithTz)); + } + + [Test ()] + public void TestParameterToStringForDateTimeWithUFormat () + { + // Setup the DateTimeFormat across all of the calls + Configuration.Default.DateTimeFormat = "u"; + ApiClient api = new ApiClient(); + + // test datetime + DateTime dateUtc = DateTime.Parse("2009-06-15 20:45:30Z", null, System.Globalization.DateTimeStyles.RoundtripKind); + Assert.AreEqual("2009-06-15 20:45:30Z", api.ParameterToString(dateUtc)); + } + + [Test ()] + public void TestParameterToStringForDateTimeWithCustomFormat () + { + // Setup the DateTimeFormat across all of the calls + Configuration.Default.DateTimeFormat = "dd/MM/yy HH:mm:ss"; + ApiClient api = new ApiClient(); + + // test datetime + DateTime dateUtc = DateTime.Parse("2009-06-15 20:45:30Z", null, System.Globalization.DateTimeStyles.RoundtripKind); + Assert.AreEqual("15/06/09 20:45:30", api.ParameterToString(dateUtc)); + } + + [Test ()] + public void TestSanitizeFilename () + { + Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("sun.gif")); + Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("../sun.gif")); + Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("/var/tmp/sun.gif")); + Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("./sun.gif")); + + Assert.AreEqual("sun", ApiClient.SanitizeFilename("sun")); + Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("..\\sun.gif")); + Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("\\var\\tmp\\sun.gif")); + Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename("c:\\var\\tmp\\sun.gif")); + Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename(".\\sun.gif")); + + } + + [Test ()] + public void TestApiClientInstance () + { + PetApi p1 = new PetApi (); + PetApi p2 = new PetApi (); + + Configuration c1 = new Configuration (); // using default ApiClient + PetApi p3 = new PetApi (c1); + + ApiClient a1 = new ApiClient(); + Configuration c2 = new Configuration (a1); // using "a1" as the ApiClient + PetApi p4 = new PetApi (c2); + + + // ensure both using the same default ApiClient + Assert.AreSame(p1.Configuration.ApiClient, p2.Configuration.ApiClient); + Assert.AreSame(p1.Configuration.ApiClient, Configuration.Default.ApiClient); + + // ensure both using the same default ApiClient + Assert.AreSame(p3.Configuration.ApiClient, c1.ApiClient); + Assert.AreSame(p3.Configuration.ApiClient, Configuration.Default.ApiClient); + + // ensure it's not using the default ApiClient + Assert.AreSame(p4.Configuration.ApiClient, c2.ApiClient); + Assert.AreNotSame(p4.Configuration.ApiClient, Configuration.Default.ApiClient); + + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs new file mode 100644 index 00000000000..936751317ab --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs @@ -0,0 +1,129 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using IO.Swagger.Client; +using IO.Swagger.Api; +using IO.Swagger.Model; + +namespace IO.Swagger.Test +{ + public class ConfigurationTests + { + public ConfigurationTests () + { + } + + [TearDown ()] + public void TearDown () + { + // Reset to default, just in case + Configuration.Default.DateTimeFormat = "o"; + } + + [Test ()] + public void TestAuthentication () + { + Configuration c = new Configuration (); + c.Username = "test_username"; + c.Password = "test_password"; + + c.ApiKey ["api_key_identifier"] = "1233456778889900"; + c.ApiKeyPrefix ["api_key_identifier"] = "PREFIX"; + Assert.AreEqual (c.GetApiKeyWithPrefix("api_key_identifier"), "PREFIX 1233456778889900"); + + } + + [Test ()] + public void TestBasePath () + { + PetApi p = new PetApi ("http://new-basepath.com"); + Assert.AreEqual (p.Configuration.ApiClient.RestClient.BaseUrl, "http://new-basepath.com"); + // Given that PetApi is initailized with a base path, a new configuration (with a new ApiClient) + // is created by default + Assert.AreNotSame (p.Configuration, Configuration.Default); + } + + [Test ()] + public void TestDateTimeFormat_Default () + { + // Should default to the Round-trip Format Specifier - "o" + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + Assert.AreEqual("o", Configuration.Default.DateTimeFormat); + } + + [Test ()] + public void TestDateTimeFormat_UType() + { + Configuration.Default.DateTimeFormat = "u"; + + Assert.AreEqual("u", Configuration.Default.DateTimeFormat); + } + + [Test ()] + public void TestConstructor() + { + Configuration c = new Configuration (username: "test username", password: "test password"); + Assert.AreEqual (c.Username, "test username"); + Assert.AreEqual (c.Password, "test password"); + + } + + [Test ()] + public void TestDefautlConfiguration () + { + PetApi p1 = new PetApi (); + PetApi p2 = new PetApi (); + Assert.AreSame (p1.Configuration, p2.Configuration); + // same as the default + Assert.AreSame (p1.Configuration, Configuration.Default); + + Configuration c = new Configuration (); + Assert.AreNotSame (c, p1.Configuration); + + PetApi p3 = new PetApi (c); + // same as c + Assert.AreSame (p3.Configuration, c); + // not same as default + Assert.AreNotSame (p3.Configuration, p1.Configuration); + + } + + [Test ()] + public void TestUsage () + { + // basic use case using default base URL + PetApi p1 = new PetApi (); + Assert.AreSame (p1.Configuration, Configuration.Default, "PetApi should use default configuration"); + + // using a different base URL + PetApi p2 = new PetApi ("http://new-base-url.com/"); + Assert.AreEqual (p2.Configuration.ApiClient.RestClient.BaseUrl.ToString(), "http://new-base-url.com/"); + + // using a different configuration + Configuration c1 = new Configuration (); + PetApi p3 = new PetApi (c1); + Assert.AreSame (p3.Configuration, c1); + + // using a different base URL via a new ApiClient + ApiClient a1 = new ApiClient ("http://new-api-client.com"); + Configuration c2 = new Configuration (a1); + PetApi p4 = new PetApi (c2); + Assert.AreSame (p4.Configuration.ApiClient, a1); + } + + [Test ()] + public void TestTimeout () + { + Configuration c1 = new Configuration (); + Assert.AreEqual (100000, c1.Timeout); // default vaue + + c1.Timeout = 50000; + Assert.AreEqual (50000, c1.Timeout); + + Configuration c2 = new Configuration (timeout: 20000); + Assert.AreEqual (20000, c2.Timeout); + } + + } +} + diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index fb3fb1ab975..231c0ab87ad 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -1,5 +1,5 @@ - + Debug AnyCPU @@ -38,36 +38,43 @@ - $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll - ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll - ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll - ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll + $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll + ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll - ..\..\vendor\NUnit.2.6.3\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.2.6.3\lib\nunit.framework.dll + ..\packages\NUnit.2.6.3\lib\nunit.framework.dll + ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll + ..\..\vendor\NUnit.2.6.3\lib\nunit.framework.dll - + + + - + - - {74456AF8-75EE-4ABC-97EB-CA96A472DD21} - IO.Swagger - + + {1293D07E-F404-42B9-8BC7-0A4DAD18E83B} + IO.Swagger + + + + + + + - diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs index 861ca5fe026..e7356e3750d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/AnimalTests.cs @@ -29,7 +29,7 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Animal(); + instance = new Animal(ClassName: "csharp test"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs index 15cc1ab22de..72e65f60bf0 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/CatTests.cs @@ -29,7 +29,7 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Cat(); + instance = new Cat(ClassName: "csharp test"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs index 33aa6cb51af..624c16d479d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/DogTests.cs @@ -29,7 +29,7 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Dog(); + instance = new Dog(ClassName: "csharp test"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs index 8c81c81fbb1..d2a3fc86c78 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/EnumClassTests.cs @@ -50,6 +50,22 @@ namespace IO.Swagger.Test Assert.IsInstanceOf (instance, "instance is a EnumClass"); } + /// + /// Test EnumClass + /// + [Test] + public void EnumClassValueTest () + { + // test serialization for string + Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumClass.Abc), "\"_abc\""); + + // test serialization for number + Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1), "\"-1\""); + + // test cast to int + Assert.AreEqual ((int)EnumTest.EnumIntegerEnum.NUMBER_MINUS_1, -1); + + } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs index 7676fcae9b9..e1d59bcc174 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/FormatTestTests.cs @@ -29,7 +29,7 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new FormatTest(); + instance = new FormatTest(Number: 123, _Byte: new byte[] { 0x20 }, Date: new DateTime(2015, 1, 18), Password: "xyz"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs index c6c68253ca0..d8fbafe238c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/NameTests.cs @@ -29,7 +29,7 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new Name(); + instance = new Name(_Name: 1, Property: "csharp"); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs index 9363c7409e4..2d55d2300f9 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OrderTests.cs @@ -41,6 +41,16 @@ namespace IO.Swagger.Test } + /// + /// Test creating a new instance of Order + /// + [Test ()] + public void TestNewOrder() + { + Order o = new Order (); + Assert.IsNull (o.Id); + } + /// /// Test an instance of Order /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs index d016d3500a4..24be033f6c5 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/PetTests.cs @@ -23,13 +23,15 @@ namespace IO.Swagger.Test { private Pet instance; + private long petId = 11088; + /// /// Setup before each test /// [SetUp] public void Init() { - instance = new Pet(); + instance = new Pet(Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" }); } /// @@ -99,6 +101,69 @@ namespace IO.Swagger.Test // TODO: unit test for the property 'Status' } + /// + /// Test Equal + /// + [Test ()] + public void TestEqual() + { + // create pet + Pet p1 = new Pet (Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" }); + p1.Id = petId; + //p1.Name = "Csharp test"; + p1.Status = Pet.StatusEnum.Available; + // create Category object + Category category1 = new Category (); + category1.Id = 56; + category1.Name = "sample category name2"; + List photoUrls1 = new List (new String[] { "sample photoUrls" }); + // create Tag object + Tag tag1 = new Tag (); + tag1.Id = petId; + tag1.Name = "csharp sample tag name1"; + List tags1 = new List (new Tag[] { tag1 }); + p1.Tags = tags1; + p1.Category = category1; + p1.PhotoUrls = photoUrls1; + + // create pet 2 + Pet p2 = new Pet (Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" }); + p2.Id = petId; + p2.Name = "Csharp test"; + p2.Status = Pet.StatusEnum.Available; + // create Category object + Category category2 = new Category (); + category2.Id = 56; + category2.Name = "sample category name2"; + List photoUrls2 = new List (new String[] { "sample photoUrls" }); + // create Tag object + Tag tag2 = new Tag (); + tag2.Id = petId; + tag2.Name = "csharp sample tag name1"; + List tags2 = new List (new Tag[] { tag2 }); + p2.Tags = tags2; + p2.Category = category2; + p2.PhotoUrls = photoUrls2; + + // p1 and p2 should be equal (both object and attribute level) + Assert.IsTrue (category1.Equals (category2)); + Assert.IsTrue (tags1.SequenceEqual (tags2)); + Assert.IsTrue (p1.PhotoUrls.SequenceEqual (p2.PhotoUrls)); + + Assert.IsTrue (p1.Equals (p2)); + + // update attribute to that p1 and p2 are not equal + category2.Name = "new category name"; + Assert.IsFalse (category1.Equals (category2)); + + tags2 = new List (); + Assert.IsFalse (tags1.SequenceEqual (tags2)); + + // photoUrls has not changed so it should be equal + Assert.IsTrue (p1.PhotoUrls.SequenceEqual (p2.PhotoUrls)); + + Assert.IsFalse (p1.Equals (p2)); + } } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/swagger-logo.png b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/swagger-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..7671d64c7da5320f6a477a3ae9a6af9ebba077ae GIT binary patch literal 11917 zcmV;8E^^U{P)|xEG zOp@7W-ppJ6=iEuy%*?#W%s>*j`CN&UH}Bnd@AsbVo`tJE_+Lm@GwJQv9iZZmqJ$wF z34q0v2Rz4vFXRN1Aq#)!AR>uiG}u7kjUdS)ekK5i*Mub>er^Z7&J3-d8qnk4v#n(y z(Y+);`&_2$dAuHf!g7FpU%=1l*{Z7I|A#;ZiQSW~HR9*qP%9KTDxslm3)n5ioZVC) z>~CG0Wj7ZMk(KaBfj69CHfE192-X7p-NbPMPw%6ul7i0`!&0C%D0b|?-@m{yZ})~; z_6#mO!{rG!%N~D|G9d4CaC-KD&0GLt#E0WC;`>W@2L%*W0g>KIu;K4AduP31X7few zBz2CF{_Yps@Us9uS7GmLH|OI!gz@_U_U`mOdUu-7P}mCw{EX&06n3+@_2GNc92f;F zn2Zj50tX^qN1xOEXwFh?0`$X16RxtwlFc|t`3RnI*oWsi1`k3|jK>ACRTfXr(ee5c z>_+?>;h0Tuj632zVTPhgH_J*yEL4UyAt>6dM#YZ{xdj(+FM_NFpS2mE?Zh6SF>svP z@8-5207i}e5J*(jgda>W862kzyy;9G0>x~|8lGbxXr*0gG3FflmLAMWJOiPCSkiHN z9sx#Q98BGArpFal(HP3|$K&&5zd>)?qbTwwNeQhBM|>Lrzr&3m3FX(3vU)ok4$mN5dhT(BVHitId=@4nLrNJ+eCqS>_*1U+jP9~LX<(Sz#TmkdG-K~7Oa;w9d8h@4?`9>41sd9DEXUE zMp-G#q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3WdF|DvJE7kK@XaP0hf5k=2+x4b}2Ns0sCo*^g#zlJ=u)vIg1C2eKSl zfxtN!Ro@T2OP^YSJ}VC#E~uf_$x8S&f6)0_IO2Dp{4)`$&P1KgFbUb&WV0a)^=HnK z=~G;VRUT1-$Tk~rOzRLF8^Us6J%W0DDB^OH+Xr{#xYfStPS`I5$gYqVY~=K@0_B4h zoJ1$NZhMZctRNt^O+ofm9*TIzILt-EbUKp-K~{p4C=V%;poJx{Kw&DVszfA74!85X zt^uh>&>L#5L2d3UU#O)XDau+^g%-2H;bGySo#zkay1*T(In=jXztT94rats9=f!2l zuIvqlUC`>;LnT~vQm9Sm^z0d6HRTVLfJxT?x33fwZK z(HA5B2EW+;xj|?C!V_%TWw#X9JIuv$t9y@J=%|c>iDkajA7V9XKeQwLe*p#n5$gPj Tf0=1800000NkvXXu0mjfB5M3m literal 0 HcmV?d00001 diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 16f73d99230..9bdafe14c34 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {74456AF8-75EE-4ABC-97EB-CA96A472DD21} + {1293D07E-F404-42B9-8BC7-0A4DAD18E83B} Library Properties Swagger Library diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs index ba5bf4d2ab4..a1d69d92f86 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Animal.cs @@ -38,8 +38,6 @@ namespace IO.Swagger.Model { this.ClassName = ClassName; } - - // use default value if no "Color" provided if (Color == null) { @@ -49,7 +47,6 @@ namespace IO.Swagger.Model { this.Color = Color; } - } /// @@ -71,7 +68,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Animal {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); -sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs index 76685fe8495..89ac71d7d1e 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/AnimalFarm.cs @@ -22,8 +22,6 @@ namespace IO.Swagger.Model /// public AnimalFarm() { - - } /// @@ -34,7 +32,7 @@ namespace IO.Swagger.Model { var sb = new StringBuilder(); sb.Append("class AnimalFarm {\n"); - sb.Append("}\n"); + sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs index 8a0f40369fb..c4720de276a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ApiResponse.cs @@ -25,14 +25,9 @@ namespace IO.Swagger.Model /// Message. public ApiResponse(int? Code = null, string Type = null, string Message = null) { - - - this.Code = Code; - - this.Type = Type; - - this.Message = Message; - + this.Code = Code; + this.Type = Type; + this.Message = Message; } /// @@ -59,8 +54,8 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class ApiResponse {\n"); sb.Append(" Code: ").Append(Code).Append("\n"); -sb.Append(" Type: ").Append(Type).Append("\n"); -sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs index 10ea622f999..0ecfc2ee3f5 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Cat.cs @@ -39,8 +39,6 @@ namespace IO.Swagger.Model { this.ClassName = ClassName; } - - // use default value if no "Color" provided if (Color == null) { @@ -50,9 +48,7 @@ namespace IO.Swagger.Model { this.Color = Color; } - - this.Declawed = Declawed; - + this.Declawed = Declawed; } /// @@ -79,8 +75,8 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Cat {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); -sb.Append(" Color: ").Append(Color).Append("\n"); -sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" Declawed: ").Append(Declawed).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs index 51a3f971b38..bac1069ab9c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Category.cs @@ -24,12 +24,8 @@ namespace IO.Swagger.Model /// Name. public Category(long? Id = null, string Name = null) { - - - this.Id = Id; - - this.Name = Name; - + this.Id = Id; + this.Name = Name; } /// @@ -51,7 +47,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Category {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); -sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs index bbd61a8535b..7984703d1b0 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Dog.cs @@ -39,8 +39,6 @@ namespace IO.Swagger.Model { this.ClassName = ClassName; } - - // use default value if no "Color" provided if (Color == null) { @@ -50,9 +48,7 @@ namespace IO.Swagger.Model { this.Color = Color; } - - this.Breed = Breed; - + this.Breed = Breed; } /// @@ -79,8 +75,8 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Dog {\n"); sb.Append(" ClassName: ").Append(ClassName).Append("\n"); -sb.Append(" Color: ").Append(Color).Append("\n"); -sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" Breed: ").Append(Breed).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs index f8bebd6b2d7..721482f31c5 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/EnumTest.cs @@ -100,14 +100,9 @@ namespace IO.Swagger.Model /// EnumNumber. public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, EnumNumberEnum? EnumNumber = null) { - - - this.EnumString = EnumString; - - this.EnumInteger = EnumInteger; - - this.EnumNumber = EnumNumber; - + this.EnumString = EnumString; + this.EnumInteger = EnumInteger; + this.EnumNumber = EnumNumber; } /// @@ -119,8 +114,8 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class EnumTest {\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); -sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); -sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); + sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); + sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs index 51c2d920e30..a0d33e71bb4 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/FormatTest.cs @@ -76,26 +76,15 @@ namespace IO.Swagger.Model { this.Password = Password; } - - - this.Integer = Integer; - - this.Int32 = Int32; - - this.Int64 = Int64; - - this._Float = _Float; - - this._Double = _Double; - - this._String = _String; - - this.Binary = Binary; - - this.DateTime = DateTime; - - this.Uuid = Uuid; - + this.Integer = Integer; + this.Int32 = Int32; + this.Int64 = Int64; + this._Float = _Float; + this._Double = _Double; + this._String = _String; + this.Binary = Binary; + this.DateTime = DateTime; + this.Uuid = Uuid; } /// @@ -172,18 +161,18 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class FormatTest {\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); -sb.Append(" Int32: ").Append(Int32).Append("\n"); -sb.Append(" Int64: ").Append(Int64).Append("\n"); -sb.Append(" Number: ").Append(Number).Append("\n"); -sb.Append(" _Float: ").Append(_Float).Append("\n"); -sb.Append(" _Double: ").Append(_Double).Append("\n"); -sb.Append(" _String: ").Append(_String).Append("\n"); -sb.Append(" _Byte: ").Append(_Byte).Append("\n"); -sb.Append(" Binary: ").Append(Binary).Append("\n"); -sb.Append(" Date: ").Append(Date).Append("\n"); -sb.Append(" DateTime: ").Append(DateTime).Append("\n"); -sb.Append(" Uuid: ").Append(Uuid).Append("\n"); -sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Int32: ").Append(Int32).Append("\n"); + sb.Append(" Int64: ").Append(Int64).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" _Float: ").Append(_Float).Append("\n"); + sb.Append(" _Double: ").Append(_Double).Append("\n"); + sb.Append(" _String: ").Append(_String).Append("\n"); + sb.Append(" _Byte: ").Append(_Byte).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs index cec5ee75e2f..c772fedc172 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Model200Response.cs @@ -23,10 +23,7 @@ namespace IO.Swagger.Model /// Name. public Model200Response(int? Name = null) { - - - this.Name = Name; - + this.Name = Name; } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs index 3cfa6c0a77e..b5fa9d341f6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs @@ -23,10 +23,7 @@ namespace IO.Swagger.Model /// _Return. public ModelReturn(int? _Return = null) { - - - this._Return = _Return; - + this._Return = _Return; } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs index 6ca08ca5f7e..35a69deba48 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Name.cs @@ -38,10 +38,7 @@ namespace IO.Swagger.Model { this._Name = _Name; } - - - this.Property = Property; - + this.Property = Property; } /// @@ -73,9 +70,9 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Name {\n"); sb.Append(" _Name: ").Append(_Name).Append("\n"); -sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); -sb.Append(" Property: ").Append(Property).Append("\n"); -sb.Append(" _123Number: ").Append(_123Number).Append("\n"); + sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); + sb.Append(" Property: ").Append(Property).Append("\n"); + sb.Append(" _123Number: ").Append(_123Number).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs index 652128a33a1..b030bab781a 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Order.cs @@ -61,18 +61,11 @@ namespace IO.Swagger.Model /// Complete (default to false). public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null) { - - - this.Id = Id; - - this.PetId = PetId; - - this.Quantity = Quantity; - - this.ShipDate = ShipDate; - - this.Status = Status; - + this.Id = Id; + this.PetId = PetId; + this.Quantity = Quantity; + this.ShipDate = ShipDate; + this.Status = Status; // use default value if no "Complete" provided if (Complete == null) { @@ -82,7 +75,6 @@ namespace IO.Swagger.Model { this.Complete = Complete; } - } /// @@ -119,11 +111,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Order {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); -sb.Append(" PetId: ").Append(PetId).Append("\n"); -sb.Append(" Quantity: ").Append(Quantity).Append("\n"); -sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); -sb.Append(" Status: ").Append(Status).Append("\n"); -sb.Append(" Complete: ").Append(Complete).Append("\n"); + sb.Append(" PetId: ").Append(PetId).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs index 50cdb903f94..ace8a28d34c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Pet.cs @@ -84,16 +84,10 @@ namespace IO.Swagger.Model { this.PhotoUrls = PhotoUrls; } - - - this.Id = Id; - - this.Category = Category; - - this.Tags = Tags; - - this.Status = Status; - + this.Id = Id; + this.Category = Category; + this.Tags = Tags; + this.Status = Status; } /// @@ -130,11 +124,11 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Pet {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); -sb.Append(" Category: ").Append(Category).Append("\n"); -sb.Append(" Name: ").Append(Name).Append("\n"); -sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); -sb.Append(" Tags: ").Append(Tags).Append("\n"); -sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Tags: ").Append(Tags).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs index 68a92724b1f..fa2962f6914 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/SpecialModelName.cs @@ -23,10 +23,7 @@ namespace IO.Swagger.Model /// SpecialPropertyName. public SpecialModelName(long? SpecialPropertyName = null) { - - - this.SpecialPropertyName = SpecialPropertyName; - + this.SpecialPropertyName = SpecialPropertyName; } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs index ffb42e09df9..b1d6f167837 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/Tag.cs @@ -24,12 +24,8 @@ namespace IO.Swagger.Model /// Name. public Tag(long? Id = null, string Name = null) { - - - this.Id = Id; - - this.Name = Name; - + this.Id = Id; + this.Name = Name; } /// @@ -51,7 +47,7 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class Tag {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); -sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs index 3931afbf0f8..ef933e5469f 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/User.cs @@ -30,24 +30,14 @@ namespace IO.Swagger.Model /// User Status. public User(long? Id = null, string Username = null, string FirstName = null, string LastName = null, string Email = null, string Password = null, string Phone = null, int? UserStatus = null) { - - - this.Id = Id; - - this.Username = Username; - - this.FirstName = FirstName; - - this.LastName = LastName; - - this.Email = Email; - - this.Password = Password; - - this.Phone = Phone; - - this.UserStatus = UserStatus; - + this.Id = Id; + this.Username = Username; + this.FirstName = FirstName; + this.LastName = LastName; + this.Email = Email; + this.Password = Password; + this.Phone = Phone; + this.UserStatus = UserStatus; } /// @@ -100,13 +90,13 @@ namespace IO.Swagger.Model var sb = new StringBuilder(); sb.Append("class User {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); -sb.Append(" Username: ").Append(Username).Append("\n"); -sb.Append(" FirstName: ").Append(FirstName).Append("\n"); -sb.Append(" LastName: ").Append(LastName).Append("\n"); -sb.Append(" Email: ").Append(Email).Append("\n"); -sb.Append(" Password: ").Append(Password).Append("\n"); -sb.Append(" Phone: ").Append(Phone).Append("\n"); -sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); + sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); sb.Append("}\n"); return sb.ToString(); }