Merge pull request #2301 from wing328/update_test_file

Update wording for test files
This commit is contained in:
wing328 2016-03-04 10:23:13 +08:00
commit 1e4fb0ec96
36 changed files with 1146 additions and 20 deletions

View File

@ -14,6 +14,13 @@ using {{packageName}}.Api;
namespace {{packageName}}.Test
{
/// <summary>
/// Class for testing {{classname}}
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class {{classname}}Tests
{

View File

@ -13,6 +13,13 @@ using System.Reflection;
{{#model}}
namespace {{packageName}}.Test
{
/// <summary>
/// Class for testing {{classname}}
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class {{classname}}Tests
{

View File

@ -14,8 +14,8 @@
# limitations under the License.
#
#
# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
# NOTE: This class is auto generated by Swagger Codegen
# Please update the test case below to test the API endpoints.
#
use Test::More tests => 1; #TODO update number of test cases
use Test::Exception;

View File

@ -1,3 +1,6 @@
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test case below to test the model.
use Test::More tests => 2;
use Test::Exception;

View File

@ -28,7 +28,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the endpoint.
*/
namespace {{apiPackage}};

View File

@ -30,7 +30,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the model.
*/
namespace {{modelPackage}};

View File

@ -11,6 +11,13 @@ using System.Reflection;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing Category
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class CategoryTests
{

View File

@ -11,6 +11,13 @@ using System.Reflection;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing Order
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class OrderTests
{

View File

@ -13,6 +13,13 @@ using IO.Swagger.Model;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing PetApi
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class PetApiTests
{
@ -155,6 +162,19 @@ namespace IO.Swagger.Test
}
/// <summary>
/// Test GetPetByIdInObject
/// </summary>
[Test]
public void GetPetByIdInObjectTest()
{
// TODO: add unit test for the method 'GetPetByIdInObject'
long? petId = null; // TODO: replace null with proper value
var response = instance.GetPetByIdInObject(petId);
Assert.IsInstanceOf<InlineResponse200> (response, "response is InlineResponse200");
}
/// <summary>
/// Test PetPetIdtestingByteArraytrueGet
/// </summary>

View File

@ -11,6 +11,13 @@ using System.Reflection;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing Pet
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class PetTests
{

View File

@ -13,6 +13,13 @@ using IO.Swagger.Model;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing StoreApi
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class StoreApiTests
{
@ -71,6 +78,18 @@ namespace IO.Swagger.Test
Assert.IsInstanceOf<Dictionary<string, int?>> (response, "response is Dictionary<string, int?>");
}
/// <summary>
/// Test GetInventoryInObject
/// </summary>
[Test]
public void GetInventoryInObjectTest()
{
// TODO: add unit test for the method 'GetInventoryInObject'
var response = instance.GetInventoryInObject();
Assert.IsInstanceOf<Object> (response, "response is Object");
}
/// <summary>
/// Test PlaceOrder
/// </summary>

View File

@ -11,6 +11,13 @@ using System.Reflection;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing Tag
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class TagTests
{

View File

@ -13,6 +13,13 @@ using IO.Swagger.Model;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing UserApi
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the API endpoint.
/// </remarks>
[TestFixture]
public class UserApiTests
{

View File

@ -11,6 +11,13 @@ using System.Reflection;
namespace IO.Swagger.Test
{
/// <summary>
/// Class for testing User
/// </summary>
/// <remarks>
/// This file is automatically generated by Swagger Codegen.
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class UserTests
{

View File

@ -203,6 +203,28 @@ namespace IO.Swagger.Api
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null);
/// <summary>
/// Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>InlineResponse200</returns>
InlineResponse200 GetPetByIdInObject (long? petId);
/// <summary>
/// Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of InlineResponse200</returns>
ApiResponse<InlineResponse200> GetPetByIdInObjectWithHttpInfo (long? petId);
/// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
/// </summary>
@ -437,6 +459,28 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null);
/// <summary>
/// Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Task of InlineResponse200</returns>
System.Threading.Tasks.Task<InlineResponse200> GetPetByIdInObjectAsync (long? petId);
/// <summary>
/// Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Task of ApiResponse (InlineResponse200)</returns>
System.Threading.Tasks.Task<ApiResponse<InlineResponse200>> GetPetByIdInObjectAsyncWithHttpInfo (long? petId);
/// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
/// </summary>
@ -1978,6 +2022,192 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39; Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>InlineResponse200</returns>
public InlineResponse200 GetPetByIdInObject (long? petId)
{
ApiResponse<InlineResponse200> localVarResponse = GetPetByIdInObjectWithHttpInfo(petId);
return localVarResponse.Data;
}
/// <summary>
/// Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39; Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of InlineResponse200</returns>
public ApiResponse< InlineResponse200 > GetPetByIdInObjectWithHttpInfo (long? petId)
{
// verify the required parameter 'petId' is set
if (petId == null)
throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->GetPetByIdInObject");
var localVarPath = "/pet/{petId}?response=inline_arbitrary_object";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new Dictionary<String, String>();
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json", "application/xml"
};
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
// authentication (api_key) required
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key")))
{
localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key");
}
// authentication (petstore_auth) required
// oauth required
if (!String.IsNullOrEmpty(Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken;
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (localVarStatusCode >= 400)
throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.Content, localVarResponse.Content);
else if (localVarStatusCode == 0)
throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage);
return new ApiResponse<InlineResponse200>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(InlineResponse200) Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponse200)));
}
/// <summary>
/// Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39; Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Task of InlineResponse200</returns>
public async System.Threading.Tasks.Task<InlineResponse200> GetPetByIdInObjectAsync (long? petId)
{
ApiResponse<InlineResponse200> localVarResponse = await GetPetByIdInObjectAsyncWithHttpInfo(petId);
return localVarResponse.Data;
}
/// <summary>
/// Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39; Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Task of ApiResponse (InlineResponse200)</returns>
public async System.Threading.Tasks.Task<ApiResponse<InlineResponse200>> GetPetByIdInObjectAsyncWithHttpInfo (long? petId)
{
// verify the required parameter 'petId' is set
if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetByIdInObject");
var localVarPath = "/pet/{petId}?response=inline_arbitrary_object";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new Dictionary<String, String>();
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json", "application/xml"
};
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter
// authentication (api_key) required
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key")))
{
localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key");
}
// authentication (petstore_auth) required
// oauth required
if (!String.IsNullOrEmpty(Configuration.AccessToken))
{
localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken;
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (localVarStatusCode >= 400)
throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.Content, localVarResponse.Content);
else if (localVarStatusCode == 0)
throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage);
return new ApiResponse<InlineResponse200>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(InlineResponse200) Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponse200)));
}
/// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39; Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>

View File

@ -59,6 +59,26 @@ namespace IO.Swagger.Api
/// <returns>ApiResponse of Dictionary&lt;string, int?&gt;</returns>
ApiResponse<Dictionary<string, int?>> GetInventoryWithHttpInfo ();
/// <summary>
/// Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
/// </summary>
/// <remarks>
/// Returns an arbitrary object which is actually a map of status codes to quantities
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Object</returns>
Object GetInventoryInObject ();
/// <summary>
/// Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
/// </summary>
/// <remarks>
/// Returns an arbitrary object which is actually a map of status codes to quantities
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>ApiResponse of Object</returns>
ApiResponse<Object> GetInventoryInObjectWithHttpInfo ();
/// <summary>
/// Place an order for a pet
/// </summary>
@ -171,6 +191,26 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse (Dictionary&lt;string, int?&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<Dictionary<string, int?>>> GetInventoryAsyncWithHttpInfo ();
/// <summary>
/// Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
/// </summary>
/// <remarks>
/// Returns an arbitrary object which is actually a map of status codes to quantities
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Task of Object</returns>
System.Threading.Tasks.Task<Object> GetInventoryInObjectAsync ();
/// <summary>
/// Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
/// </summary>
/// <remarks>
/// Returns an arbitrary object which is actually a map of status codes to quantities
/// </remarks>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Task of ApiResponse (Object)</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> GetInventoryInObjectAsyncWithHttpInfo ();
/// <summary>
/// Place an order for a pet
/// </summary>
@ -654,6 +694,165 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Fake endpoint to test arbitrary object return by &#39;Get inventory&#39; Returns an arbitrary object which is actually a map of status codes to quantities
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Object</returns>
public Object GetInventoryInObject ()
{
ApiResponse<Object> localVarResponse = GetInventoryInObjectWithHttpInfo();
return localVarResponse.Data;
}
/// <summary>
/// Fake endpoint to test arbitrary object return by &#39;Get inventory&#39; Returns an arbitrary object which is actually a map of status codes to quantities
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>ApiResponse of Object</returns>
public ApiResponse< Object > GetInventoryInObjectWithHttpInfo ()
{
var localVarPath = "/store/inventory?response=arbitrary_object";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new Dictionary<String, String>();
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json", "application/xml"
};
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
// authentication (api_key) required
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key")))
{
localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key");
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (localVarStatusCode >= 400)
throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.Content, localVarResponse.Content);
else if (localVarStatusCode == 0)
throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage);
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Object) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object)));
}
/// <summary>
/// Fake endpoint to test arbitrary object return by &#39;Get inventory&#39; Returns an arbitrary object which is actually a map of status codes to quantities
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Task of Object</returns>
public async System.Threading.Tasks.Task<Object> GetInventoryInObjectAsync ()
{
ApiResponse<Object> localVarResponse = await GetInventoryInObjectAsyncWithHttpInfo();
return localVarResponse.Data;
}
/// <summary>
/// Fake endpoint to test arbitrary object return by &#39;Get inventory&#39; Returns an arbitrary object which is actually a map of status codes to quantities
/// </summary>
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Task of ApiResponse (Object)</returns>
public async System.Threading.Tasks.Task<ApiResponse<Object>> GetInventoryInObjectAsyncWithHttpInfo ()
{
var localVarPath = "/store/inventory?response=arbitrary_object";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new Dictionary<String, String>();
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json", "application/xml"
};
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
// set "format" to json by default
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
localVarPathParams.Add("format", "json");
// authentication (api_key) required
if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key")))
{
localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key");
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (localVarStatusCode >= 400)
throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.Content, localVarResponse.Content);
else if (localVarStatusCode == 0)
throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage);
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Object) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object)));
}
/// <summary>
/// Place an order for a pet
/// </summary>

View File

@ -0,0 +1,157 @@
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace IO.Swagger.Model
{
/// <summary>
///
/// </summary>
[DataContract]
public partial class InlineResponse200 : IEquatable<InlineResponse200>
{
/// <summary>
/// Initializes a new instance of the <see cref="InlineResponse200" />class.
/// </summary>
/// <param name="Id">Id (required).</param>
/// <param name="Category">Category.</param>
/// <param name="Name">Name.</param>
public InlineResponse200(long? Id = null, Object Category = null, string Name = null)
{
// to ensure "Id" is required (not null)
if (Id == null)
{
throw new InvalidDataException("Id is a required property for InlineResponse200 and cannot be null");
}
else
{
this.Id = Id;
}
this.Category = Category;
this.Name = Name;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name="id", EmitDefaultValue=false)]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Category
/// </summary>
[DataMember(Name="category", EmitDefaultValue=false)]
public Object Category { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name="name", EmitDefaultValue=false)]
public string Name { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class InlineResponse200 {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Category: ").Append(Category).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
// credit: http://stackoverflow.com/a/10454552/677735
return this.Equals(obj as InlineResponse200);
}
/// <summary>
/// Returns true if InlineResponse200 instances are equal
/// </summary>
/// <param name="other">Instance of InlineResponse200 to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(InlineResponse200 other)
{
// credit: http://stackoverflow.com/a/10454552/677735
if (other == null)
return false;
return
(
this.Id == other.Id ||
this.Id != null &&
this.Id.Equals(other.Id)
) &&
(
this.Category == other.Category ||
this.Category != null &&
this.Category.Equals(other.Category)
) &&
(
this.Name == other.Name ||
this.Name != null &&
this.Name.Equals(other.Name)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
// credit: http://stackoverflow.com/a/263416/677735
unchecked // Overflow is fine, just wrap
{
int hash = 41;
// Suitable nullity checks etc, of course :)
if (this.Id != null)
hash = hash * 59 + this.Id.GetHashCode();
if (this.Category != null)
hash = hash * 59 + this.Category.GetHashCode();
if (this.Name != null)
hash = hash * 59 + this.Name.GetHashCode();
return hash;
}
}
}
}

View File

@ -59,6 +59,7 @@
<Compile Include="TestConfiguration.cs" />
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Client\ApiResponse.cs" />
<Compile Include="TestOrder.cs" />
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\InlineResponse200.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>

View File

@ -1,9 +1,10 @@
<Properties StartupItem="SwaggerClientTest.csproj">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="TestPet.cs">
<MonoDevelop.Ide.Workbench ActiveDocument="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs">
<Files>
<File FileName="TestPet.cs" Line="162" Column="35" />
<File FileName="TestOrder.cs" Line="42" Column="12" />
<File FileName="TestOrder.cs" Line="1" Column="1" />
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs" Line="8" Column="24" />
</Files>
<Pads>
<Pad Id="MonoDevelop.NUnit.TestPad">

View File

@ -8,7 +8,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore
Automatically generated by the Perl Swagger Codegen project:
- Build date: 2016-02-27T21:43:00.005+08:00
- Build date: 2016-03-03T20:09:18.907+08:00
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
- Codegen version:

View File

@ -186,12 +186,12 @@ sub add_pet {
#
# Finds Pets by status
#
# @param ARRAY[string] $status Status values that need to be considered for filter (optional)
# @param ARRAY[string] $status Status values that need to be considered for query (optional)
{
my $params = {
'status' => {
data_type => 'ARRAY[string]',
description => 'Status values that need to be considered for filter',
description => 'Status values that need to be considered for query',
required => '0',
},
};
@ -662,6 +662,81 @@ sub upload_file {
}
#
# get_pet_by_id_in_object
#
# Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
#
# @param int $pet_id ID of pet that needs to be fetched (required)
{
my $params = {
'pet_id' => {
data_type => 'int',
description => 'ID of pet that needs to be fetched',
required => '1',
},
};
__PACKAGE__->method_documentation->{ get_pet_by_id_in_object } = {
summary => 'Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;',
params => $params,
returns => 'InlineResponse200',
};
}
# @return InlineResponse200
#
sub get_pet_by_id_in_object {
my ($self, %args) = @_;
# verify the required parameter 'pet_id' is set
unless (exists $args{'pet_id'}) {
croak("Missing the required parameter 'pet_id' when calling get_pet_by_id_in_object");
}
# parse inputs
my $_resource_path = '/pet/{petId}?response=inline_arbitrary_object';
$_resource_path =~ s/{format}/json/; # default format to json
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
# path params
if ( exists $args{'pet_id'}) {
my $_base_variable = "{" . "petId" . "}";
my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'});
$_resource_path =~ s/$_base_variable/$_base_value/g;
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [qw(api_key petstore_auth )];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response);
return $_response_object;
}
#
# pet_pet_idtesting_byte_arraytrue_get
#

View File

@ -37,7 +37,7 @@ has version_info => ( is => 'ro',
default => sub { {
app_name => 'Swagger Petstore',
app_version => '1.0.0',
generated_date => '2016-02-27T21:43:00.005+08:00',
generated_date => '2016-03-03T20:09:18.907+08:00',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
} },
documentation => 'Information about the application version and the codegen codebase version'
@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project:
=over 4
=item Build date: 2016-02-27T21:43:00.005+08:00
=item Build date: 2016-03-03T20:09:18.907+08:00
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen

View File

@ -51,6 +51,74 @@ sub new {
}
#
# find_orders_by_status
#
# Finds orders by status
#
# @param string $status Status value that needs to be considered for query (optional)
{
my $params = {
'status' => {
data_type => 'string',
description => 'Status value that needs to be considered for query',
required => '0',
},
};
__PACKAGE__->method_documentation->{ find_orders_by_status } = {
summary => 'Finds orders by status',
params => $params,
returns => 'ARRAY[Order]',
};
}
# @return ARRAY[Order]
#
sub find_orders_by_status {
my ($self, %args) = @_;
# parse inputs
my $_resource_path = '/store/findByStatus';
$_resource_path =~ s/{format}/json/; # default format to json
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
# query params
if ( exists $args{'status'}) {
$query_params->{'status'} = $self->{api_client}->to_query_value($args{'status'});
}
my $_body_data;
# authentication setting, if any
my $auth_settings = [qw(test_api_client_id test_api_client_secret )];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
my $_response_object = $self->{api_client}->deserialize('ARRAY[Order]', $response);
return $_response_object;
}
#
# get_inventory
#
@ -110,6 +178,65 @@ sub get_inventory {
}
#
# get_inventory_in_object
#
# Fake endpoint to test arbitrary object return by 'Get inventory'
#
{
my $params = {
};
__PACKAGE__->method_documentation->{ get_inventory_in_object } = {
summary => 'Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;',
params => $params,
returns => 'object',
};
}
# @return object
#
sub get_inventory_in_object {
my ($self, %args) = @_;
# parse inputs
my $_resource_path = '/store/inventory?response=arbitrary_object';
$_resource_path =~ s/{format}/json/; # default format to json
my $_method = 'GET';
my $query_params = {};
my $header_params = {};
my $form_params = {};
# 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml');
if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept;
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
my $_body_data;
# authentication setting, if any
my $auth_settings = [qw(api_key )];
# make the API Call
my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
my $_response_object = $self->{api_client}->deserialize('object', $response);
return $_response_object;
}
#
# place_order
#

View File

@ -98,6 +98,14 @@ isa_ok($api, 'WWW::SwaggerClient::PetApi');
my $result = $api->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file);
}
#
# get_pet_by_id_in_object test
#
{
my $pet_id = undef; # replace NULL with a proper value
my $result = $api->get_pet_by_id_in_object(pet_id => $pet_id);
}
#
# pet_pet_idtesting_byte_arraytrue_get test
#

View File

@ -29,6 +29,14 @@ use_ok('WWW::SwaggerClient::StoreApi');
my $api = WWW::SwaggerClient::StoreApi->new();
isa_ok($api, 'WWW::SwaggerClient::StoreApi');
#
# find_orders_by_status test
#
{
my $status = undef; # replace NULL with a proper value
my $result = $api->find_orders_by_status(status => $status);
}
#
# get_inventory test
#
@ -36,6 +44,13 @@ isa_ok($api, 'WWW::SwaggerClient::StoreApi');
my $result = $api->get_inventory();
}
#
# get_inventory_in_object test
#
{
my $result = $api->get_inventory_in_object();
}
#
# place_order test
#

View File

@ -50,7 +50,7 @@ is $get_pet->tags->[0]->id, '11', 'stored and retrieved: got the proper tag id';
# API method docs
is_deeply( [sort keys %{$api->pet_api->method_documentation}],
[ 'add_pet', 'add_pet_using_byte_array', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'pet_pet_idtesting_byte_arraytrue_get', 'update_pet', 'update_pet_with_form', 'upload_file'],
[ 'add_pet', 'add_pet_using_byte_array', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'get_pet_by_id_in_object', 'pet_pet_idtesting_byte_arraytrue_get', 'update_pet', 'update_pet_with_form', 'upload_file'],
"Pet API method_documentation has the correct keys");
is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{description},
'ID of pet that needs to be fetched', 'get_pet_by_id parameter pet_id description is correct';

View File

@ -878,6 +878,113 @@ class PetApi
}
}
/**
* getPetByIdInObject
*
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
*
* @param int $pet_id ID of pet that needs to be fetched (required)
* @return \Swagger\Client\Model\InlineResponse200
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function getPetByIdInObject($pet_id)
{
list($response, $statusCode, $httpHeader) = $this->getPetByIdInObjectWithHttpInfo ($pet_id);
return $response;
}
/**
* getPetByIdInObjectWithHttpInfo
*
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
*
* @param int $pet_id ID of pet that needs to be fetched (required)
* @return Array of \Swagger\Client\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function getPetByIdInObjectWithHttpInfo($pet_id)
{
// verify the required parameter 'pet_id' is set
if ($pet_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling getPetByIdInObject');
}
// parse inputs
$resourcePath = "/pet/{petId}?response=inline_arbitrary_object";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
// path params
if ($pet_id !== null) {
$resourcePath = str_replace(
"{" . "petId" . "}",
$this->apiClient->getSerializer()->toPathValue($pet_id),
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) {
$headerParams['api_key'] = $apiKey;
}
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, 'GET',
$queryParams, $httpBody,
$headerParams, '\Swagger\Client\Model\InlineResponse200'
);
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\InlineResponse200', $httpHeader), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\InlineResponse200', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* petPetIdtestingByteArraytrueGet
*

View File

@ -280,6 +280,94 @@ class StoreApi
}
}
/**
* getInventoryInObject
*
* Fake endpoint to test arbitrary object return by 'Get inventory'
*
* @return object
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function getInventoryInObject()
{
list($response, $statusCode, $httpHeader) = $this->getInventoryInObjectWithHttpInfo ();
return $response;
}
/**
* getInventoryInObjectWithHttpInfo
*
* Fake endpoint to test arbitrary object return by 'Get inventory'
*
* @return Array of object, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function getInventoryInObjectWithHttpInfo()
{
// parse inputs
$resourcePath = "/store/inventory?response=arbitrary_object";
$httpBody = '';
$queryParams = array();
$headerParams = array();
$formParams = array();
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
if (!is_null($_header_accept)) {
$headerParams['Accept'] = $_header_accept;
}
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
} elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form)
}
// this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) {
$headerParams['api_key'] = $apiKey;
}
// make the API Call
try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, 'GET',
$queryParams, $httpBody,
$headerParams, 'object'
);
if (!$response) {
return array(null, $statusCode, $httpHeader);
}
return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'object', $httpHeader), $statusCode, $httpHeader);
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'object', $e->getResponseHeaders());
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* placeOrder
*

View File

@ -28,7 +28,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the model.
*/
namespace Swagger\Client\Model;

View File

@ -28,7 +28,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the model.
*/
namespace Swagger\Client\Model;

View File

@ -28,7 +28,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the endpoint.
*/
namespace Swagger\Client\Api;
@ -145,6 +145,16 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
}
/**
* Test case for getPetByIdInObject
*
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
*
*/
public function test_getPetByIdInObject() {
}
/**
* Test case for petPetIdtestingByteArraytrueGet
*

View File

@ -28,7 +28,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the model.
*/
namespace Swagger\Client\Model;

View File

@ -28,7 +28,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the endpoint.
*/
namespace Swagger\Client\Api;
@ -85,6 +85,16 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
}
/**
* Test case for getInventoryInObject
*
* Fake endpoint to test arbitrary object return by 'Get inventory'
*
*/
public function test_getInventoryInObject() {
}
/**
* Test case for placeOrder
*

View File

@ -28,7 +28,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the model.
*/
namespace Swagger\Client\Model;

View File

@ -28,7 +28,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the endpoint.
*/
namespace Swagger\Client\Api;

View File

@ -28,7 +28,7 @@
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
* Please update the test case below to test the model.
*/
namespace Swagger\Client\Model;