private async Task InvokePost(IOwinContext context) { using (var reader = new JsonTextReader(new StreamReader(context.Request.Body, Encoding.UTF8))) { UrlEntityRequest request = new Newtonsoft.Json.JsonSerializer().Deserialize <UrlEntityRequest>(reader); var response = await _service.Create(request); context.Response.StatusCode = 201; context.Response.ContentType = "application/json"; await context.Response.WriteAsync(Newtonsoft.Json.JsonConvert.SerializeObject(response)); } }
public async void Create_and_update_entity_should_alter_url_and_add_three_urls_to_updatelog() { var result = await service.Create(testUrl1, new DateTime(2015, 01, 01)); var response = await service.GetEntity(result.Id); await service.Update(result.Id, null, testUrl2 + "?1", DateTime.UtcNow.AddDays(1)); await service.Update(result.Id, null, testUrl2 + "?2", DateTime.UtcNow.AddDays(1)); await service.Update(result.Id, null, testUrl2 + "?3", DateTime.UtcNow.AddDays(1)); response = await service.GetEntity(result.Id); }