public ResponseContract BuildResponse() { RepresentationContract[] representations = { RepresentationContract.Create("application/json", null, GetSchemaDefinition(), GetResponseSampleCode(), null) }; return(ResponseContract.Create(GetStatusCode(), _response.Description, representations)); }
private ResponseContract[] Responses() { ResponseContract[] responses = { ResponseContract.Create(200, "OK!", new RepresentationContract[] { RepresentationContract.Create("application/json", null, "typeName", null, null), RepresentationContract.Create("text/json", null, "typeName", "sample data", Parameters()), }), ResponseContract.Create(201, "Created", null), }; return(responses); }
public void UpdateOperationResponse() { string apiId = _apiId; string operationId = _operationId; APIOperation entity_v1 = Client.GetAPIOperationAsync(apiId, operationId).Result; ResponseContract response = ResponseContract.Create(400, "Ok", null); List <ResponseContract> responses = entity_v1.Responses.ToList(); responses.Add(response); APIOperation operation = new APIOperation() { Responses = responses.ToArray() }; var task = Client.UpdateAPIOperationAsync(apiId, operationId, operation); task.Wait(); APIOperation entity_v2 = Client.GetAPIOperationAsync(apiId, operationId).Result; Assert.AreEqual(entity_v2.Responses.Count(), operation.Responses.Count()); }
public void UpdateOperationResponse() { string apiId = "api_b8aad5c90425479c9e50c2513bfbc804"; string operationId = "operation_ab7e97314cb840eca6cead919d7c003b"; APIOperation entity_v1 = Client.GetAPIOperationAsync(apiId, operationId).Result; ResponseContract response = ResponseContract.Create(400, "Ok", null); List <ResponseContract> responses = entity_v1.Responses.ToList(); responses.Add(response); APIOperation operation = new APIOperation() { Responses = responses.ToArray() }; var task = Client.UpdateAPIOperationAsync(apiId, operationId, operation); task.Wait(); APIOperation entity_v2 = Client.GetAPIOperationAsync(apiId, operationId).Result; Assert.AreEqual(entity_v2.Responses.Count(), operation.Responses.Count()); }