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 3afe27063dd..2e638711b0f 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache @@ -54,6 +54,10 @@ namespace {{packageName}}.Test public void {{operationId}}Test() { // TODO: add unit test for the method '{{operationId}}' + {{#allParams}}{{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value + {{/allParams}} + {{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}}Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} } {{/operation}}{{/operations}} } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs index aeb2f1262b9..a7caec2f54c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs @@ -53,6 +53,10 @@ namespace IO.Swagger.Test public void UpdatePetTest() { // TODO: add unit test for the method 'UpdatePet' + Pet body = null; // TODO: replace null with proper value + + instance.UpdatePet(body); + } /// @@ -62,6 +66,10 @@ namespace IO.Swagger.Test public void AddPetTest() { // TODO: add unit test for the method 'AddPet' + Pet body = null; // TODO: replace null with proper value + + instance.AddPet(body); + } /// @@ -71,6 +79,10 @@ namespace IO.Swagger.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"); } /// @@ -80,6 +92,10 @@ namespace IO.Swagger.Test public void FindPetsByTagsTest() { // TODO: add unit test for the method 'FindPetsByTags' + List tags = null; // TODO: replace null with proper value + + var response = instance.FindPetsByTags(tags); + Assert.IsInstanceOf> (response, "response is List"); } /// @@ -89,6 +105,10 @@ namespace IO.Swagger.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"); } /// @@ -98,6 +118,12 @@ namespace IO.Swagger.Test public void UpdatePetWithFormTest() { // TODO: add unit test for the method 'UpdatePetWithForm' + string 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); + } /// @@ -107,6 +133,11 @@ namespace IO.Swagger.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); + } /// @@ -116,6 +147,12 @@ namespace IO.Swagger.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 + Stream file = null; // TODO: replace null with proper value + + instance.UploadFile(petId, additionalMetadata, file); + } /// @@ -125,6 +162,10 @@ namespace IO.Swagger.Test public void GetPetByIdWithByteArrayTest() { // TODO: add unit test for the method 'GetPetByIdWithByteArray' + long? petId = null; // TODO: replace null with proper value + + var response = instance.GetPetByIdWithByteArray(petId); + Assert.IsInstanceOf (response, "response is byte[]"); } /// @@ -134,6 +175,10 @@ namespace IO.Swagger.Test public void AddPetUsingByteArrayTest() { // TODO: add unit test for the method 'AddPetUsingByteArray' + byte[] body = null; // TODO: replace null with proper value + + instance.AddPetUsingByteArray(body); + } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs index f271564e62b..8e3f99eff2d 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs @@ -53,6 +53,9 @@ 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"); } /// @@ -62,6 +65,10 @@ 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"); } /// @@ -71,6 +78,10 @@ namespace IO.Swagger.Test public void GetOrderByIdTest() { // TODO: add unit test for the method 'GetOrderById' + string orderId = null; // TODO: replace null with proper value + + var response = instance.GetOrderById(orderId); + Assert.IsInstanceOf (response, "response is Order"); } /// @@ -80,6 +91,10 @@ 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); + } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs index 13d62345eb9..0d543c384aa 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/UserApiTests.cs @@ -53,6 +53,10 @@ 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); + } /// @@ -62,6 +66,10 @@ 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); + } /// @@ -71,6 +79,10 @@ 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); + } /// @@ -80,6 +92,11 @@ 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"); } /// @@ -89,6 +106,9 @@ namespace IO.Swagger.Test public void LogoutUserTest() { // TODO: add unit test for the method 'LogoutUser' + + instance.LogoutUser(); + } /// @@ -98,6 +118,10 @@ 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"); } /// @@ -107,6 +131,11 @@ 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); + } /// @@ -116,6 +145,10 @@ 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); + } }