Add test cases to cover different collection formats (#3640)

* add test cases to cover different collection format

* add space params to retrofit 1.x

* add space params to retrofit 2.x

* rename url to localVarUrl

* fix exception in haskell servant
This commit is contained in:
William Cheng
2019-08-15 11:09:12 +08:00
committed by GitHub
parent 286cdfdfa2
commit c3535cf9ca
185 changed files with 8369 additions and 190 deletions

View File

@@ -351,6 +351,35 @@ namespace Org.OpenAPITools.Api
/// <param name="param2">field2</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> TestJsonFormDataWithHttpInfo (string param, string param2);
/// <summary>
///
/// </summary>
/// <remarks>
/// To test the collection format in query parameters
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pipe"></param>
/// <param name="ioutil"></param>
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <returns></returns>
void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context);
/// <summary>
///
/// </summary>
/// <remarks>
/// To test the collection format in query parameters
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pipe"></param>
/// <param name="ioutil"></param>
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
@@ -680,6 +709,35 @@ namespace Org.OpenAPITools.Api
/// <param name="param2">field2</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> TestJsonFormDataAsyncWithHttpInfo (string param, string param2);
/// <summary>
///
/// </summary>
/// <remarks>
/// To test the collection format in query parameters
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pipe"></param>
/// <param name="ioutil"></param>
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context);
/// <summary>
///
/// </summary>
/// <remarks>
/// To test the collection format in query parameters
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pipe"></param>
/// <param name="ioutil"></param>
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> TestQueryParameterCollectionFormatAsyncWithHttpInfo (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context);
#endregion Asynchronous Operations
}
@@ -2826,5 +2884,182 @@ namespace Org.OpenAPITools.Api
null);
}
/// <summary>
/// To test the collection format in query parameters
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pipe"></param>
/// <param name="ioutil"></param>
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <returns></returns>
public void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
{
TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context);
}
/// <summary>
/// To test the collection format in query parameters
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pipe"></param>
/// <param name="ioutil"></param>
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <returns>ApiResponse of Object(void)</returns>
public ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
{
// verify the required parameter 'pipe' is set
if (pipe == null)
throw new ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'ioutil' is set
if (ioutil == null)
throw new ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'http' is set
if (http == null)
throw new ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'url' is set
if (url == null)
throw new ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'context' is set
if (context == null)
throw new ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat");
var localVarPath = "/fake/test-query-paramters";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.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 = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (pipe != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "pipe", pipe)); // query parameter
if (ioutil != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "ioutil", ioutil)); // query parameter
if (http != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("space", "http", http)); // query parameter
if (url != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "url", url)); // query parameter
if (context != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("multi", "context", context)); // query parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
null);
}
/// <summary>
/// To test the collection format in query parameters
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pipe"></param>
/// <param name="ioutil"></param>
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <returns>Task of void</returns>
public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
{
await TestQueryParameterCollectionFormatAsyncWithHttpInfo(pipe, ioutil, http, url, context);
}
/// <summary>
/// To test the collection format in query parameters
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="pipe"></param>
/// <param name="ioutil"></param>
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <returns>Task of ApiResponse</returns>
public async System.Threading.Tasks.Task<ApiResponse<Object>> TestQueryParameterCollectionFormatAsyncWithHttpInfo (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
{
// verify the required parameter 'pipe' is set
if (pipe == null)
throw new ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'ioutil' is set
if (ioutil == null)
throw new ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'http' is set
if (http == null)
throw new ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'url' is set
if (url == null)
throw new ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat");
// verify the required parameter 'context' is set
if (context == null)
throw new ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat");
var localVarPath = "/fake/test-query-paramters";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.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 = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (pipe != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "pipe", pipe)); // query parameter
if (ioutil != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "ioutil", ioutil)); // query parameter
if (http != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("space", "http", http)); // query parameter
if (url != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("csv", "url", url)); // query parameter
if (context != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("multi", "context", context)); // query parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
null);
}
}
}