Ejemplo n.º 1
0
 public ITestActionResult PostToOrders([FromODataUri] int key, [FromBody] AROOrder order)
 {
     if (key == 5 && order != null && order.Id == 5)
     {
         return(Ok());
     }
     return(BadRequest());
 }
Ejemplo n.º 2
0
        public async Task AddRelatedObjectConventionsWork(string method, string url)
        {
            object data = new AROOrder()
            {
                Id = 5
            };
            HttpRequestMessage request = new HttpRequestMessage(new HttpMethod(method), BaseAddress + url);

            request.Content = new StringContent(JsonConvert.SerializeObject(data));
            request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
            HttpResponseMessage response = await Client.SendAsync(request);

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
        }