add test case for c# method

This commit is contained in:
wing328 2016-01-31 12:49:32 +08:00
parent 4ce255dc38
commit 047abc63a4
4 changed files with 97 additions and 0 deletions

View File

@ -54,6 +54,10 @@ namespace {{packageName}}.Test
public void {{operationId}}Test() public void {{operationId}}Test()
{ {
// TODO: add unit test for the method '{{operationId}}' // 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}} {{/operation}}{{/operations}}
} }

View File

@ -53,6 +53,10 @@ namespace IO.Swagger.Test
public void UpdatePetTest() public void UpdatePetTest()
{ {
// TODO: add unit test for the method 'UpdatePet' // TODO: add unit test for the method 'UpdatePet'
Pet body = null; // TODO: replace null with proper value
instance.UpdatePet(body);
} }
/// <summary> /// <summary>
@ -62,6 +66,10 @@ namespace IO.Swagger.Test
public void AddPetTest() public void AddPetTest()
{ {
// TODO: add unit test for the method 'AddPet' // TODO: add unit test for the method 'AddPet'
Pet body = null; // TODO: replace null with proper value
instance.AddPet(body);
} }
/// <summary> /// <summary>
@ -71,6 +79,10 @@ namespace IO.Swagger.Test
public void FindPetsByStatusTest() public void FindPetsByStatusTest()
{ {
// TODO: add unit test for the method 'FindPetsByStatus' // TODO: add unit test for the method 'FindPetsByStatus'
List<string> status = null; // TODO: replace null with proper value
var response = instance.FindPetsByStatus(status);
Assert.IsInstanceOf<List<Pet>> (response, "response is List<Pet>");
} }
/// <summary> /// <summary>
@ -80,6 +92,10 @@ namespace IO.Swagger.Test
public void FindPetsByTagsTest() public void FindPetsByTagsTest()
{ {
// TODO: add unit test for the method 'FindPetsByTags' // TODO: add unit test for the method 'FindPetsByTags'
List<string> tags = null; // TODO: replace null with proper value
var response = instance.FindPetsByTags(tags);
Assert.IsInstanceOf<List<Pet>> (response, "response is List<Pet>");
} }
/// <summary> /// <summary>
@ -89,6 +105,10 @@ namespace IO.Swagger.Test
public void GetPetByIdTest() public void GetPetByIdTest()
{ {
// TODO: add unit test for the method 'GetPetById' // TODO: add unit test for the method 'GetPetById'
long? petId = null; // TODO: replace null with proper value
var response = instance.GetPetById(petId);
Assert.IsInstanceOf<Pet> (response, "response is Pet");
} }
/// <summary> /// <summary>
@ -98,6 +118,12 @@ namespace IO.Swagger.Test
public void UpdatePetWithFormTest() public void UpdatePetWithFormTest()
{ {
// TODO: add unit test for the method 'UpdatePetWithForm' // 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);
} }
/// <summary> /// <summary>
@ -107,6 +133,11 @@ namespace IO.Swagger.Test
public void DeletePetTest() public void DeletePetTest()
{ {
// TODO: add unit test for the method 'DeletePet' // 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);
} }
/// <summary> /// <summary>
@ -116,6 +147,12 @@ namespace IO.Swagger.Test
public void UploadFileTest() public void UploadFileTest()
{ {
// TODO: add unit test for the method 'UploadFile' // 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);
} }
/// <summary> /// <summary>
@ -125,6 +162,10 @@ namespace IO.Swagger.Test
public void GetPetByIdWithByteArrayTest() public void GetPetByIdWithByteArrayTest()
{ {
// TODO: add unit test for the method 'GetPetByIdWithByteArray' // TODO: add unit test for the method 'GetPetByIdWithByteArray'
long? petId = null; // TODO: replace null with proper value
var response = instance.GetPetByIdWithByteArray(petId);
Assert.IsInstanceOf<byte[]> (response, "response is byte[]");
} }
/// <summary> /// <summary>
@ -134,6 +175,10 @@ namespace IO.Swagger.Test
public void AddPetUsingByteArrayTest() public void AddPetUsingByteArrayTest()
{ {
// TODO: add unit test for the method 'AddPetUsingByteArray' // TODO: add unit test for the method 'AddPetUsingByteArray'
byte[] body = null; // TODO: replace null with proper value
instance.AddPetUsingByteArray(body);
} }
} }

View File

@ -53,6 +53,9 @@ namespace IO.Swagger.Test
public void GetInventoryTest() public void GetInventoryTest()
{ {
// TODO: add unit test for the method 'GetInventory' // TODO: add unit test for the method 'GetInventory'
var response = instance.GetInventory();
Assert.IsInstanceOf<Dictionary<string, int?>> (response, "response is Dictionary<string, int?>");
} }
/// <summary> /// <summary>
@ -62,6 +65,10 @@ namespace IO.Swagger.Test
public void PlaceOrderTest() public void PlaceOrderTest()
{ {
// TODO: add unit test for the method 'PlaceOrder' // TODO: add unit test for the method 'PlaceOrder'
Order body = null; // TODO: replace null with proper value
var response = instance.PlaceOrder(body);
Assert.IsInstanceOf<Order> (response, "response is Order");
} }
/// <summary> /// <summary>
@ -71,6 +78,10 @@ namespace IO.Swagger.Test
public void GetOrderByIdTest() public void GetOrderByIdTest()
{ {
// TODO: add unit test for the method 'GetOrderById' // TODO: add unit test for the method 'GetOrderById'
string orderId = null; // TODO: replace null with proper value
var response = instance.GetOrderById(orderId);
Assert.IsInstanceOf<Order> (response, "response is Order");
} }
/// <summary> /// <summary>
@ -80,6 +91,10 @@ namespace IO.Swagger.Test
public void DeleteOrderTest() public void DeleteOrderTest()
{ {
// TODO: add unit test for the method 'DeleteOrder' // TODO: add unit test for the method 'DeleteOrder'
string orderId = null; // TODO: replace null with proper value
instance.DeleteOrder(orderId);
} }
} }

View File

@ -53,6 +53,10 @@ namespace IO.Swagger.Test
public void CreateUserTest() public void CreateUserTest()
{ {
// TODO: add unit test for the method 'CreateUser' // TODO: add unit test for the method 'CreateUser'
User body = null; // TODO: replace null with proper value
instance.CreateUser(body);
} }
/// <summary> /// <summary>
@ -62,6 +66,10 @@ namespace IO.Swagger.Test
public void CreateUsersWithArrayInputTest() public void CreateUsersWithArrayInputTest()
{ {
// TODO: add unit test for the method 'CreateUsersWithArrayInput' // TODO: add unit test for the method 'CreateUsersWithArrayInput'
List<User> body = null; // TODO: replace null with proper value
instance.CreateUsersWithArrayInput(body);
} }
/// <summary> /// <summary>
@ -71,6 +79,10 @@ namespace IO.Swagger.Test
public void CreateUsersWithListInputTest() public void CreateUsersWithListInputTest()
{ {
// TODO: add unit test for the method 'CreateUsersWithListInput' // TODO: add unit test for the method 'CreateUsersWithListInput'
List<User> body = null; // TODO: replace null with proper value
instance.CreateUsersWithListInput(body);
} }
/// <summary> /// <summary>
@ -80,6 +92,11 @@ namespace IO.Swagger.Test
public void LoginUserTest() public void LoginUserTest()
{ {
// TODO: add unit test for the method 'LoginUser' // 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<string> (response, "response is string");
} }
/// <summary> /// <summary>
@ -89,6 +106,9 @@ namespace IO.Swagger.Test
public void LogoutUserTest() public void LogoutUserTest()
{ {
// TODO: add unit test for the method 'LogoutUser' // TODO: add unit test for the method 'LogoutUser'
instance.LogoutUser();
} }
/// <summary> /// <summary>
@ -98,6 +118,10 @@ namespace IO.Swagger.Test
public void GetUserByNameTest() public void GetUserByNameTest()
{ {
// TODO: add unit test for the method 'GetUserByName' // TODO: add unit test for the method 'GetUserByName'
string username = null; // TODO: replace null with proper value
var response = instance.GetUserByName(username);
Assert.IsInstanceOf<User> (response, "response is User");
} }
/// <summary> /// <summary>
@ -107,6 +131,11 @@ namespace IO.Swagger.Test
public void UpdateUserTest() public void UpdateUserTest()
{ {
// TODO: add unit test for the method 'UpdateUser' // 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);
} }
/// <summary> /// <summary>
@ -116,6 +145,10 @@ namespace IO.Swagger.Test
public void DeleteUserTest() public void DeleteUserTest()
{ {
// TODO: add unit test for the method 'DeleteUser' // TODO: add unit test for the method 'DeleteUser'
string username = null; // TODO: replace null with proper value
instance.DeleteUser(username);
} }
} }