Exemplo n.º 1
0
 public async Task Should_Return_Http_Status_Created_With_Id_When_Successful()
 {
     var model = new EventModel
     {
         Title = "Test",
         Start = DateTime.Now.AddDays(1),
         End = DateTime.Now.AddDays(2)
     };
     var response = await Client.CreateEvent(model, CancellationToken.None);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Updates the event.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="eventModel">The event model.</param>
 /// <param name="token">The token.</param>
 /// <returns></returns>
 public Task<GriklyHttpResponseMessage> UpdateEvent(Guid id, EventModel eventModel,
     CancellationToken token)
 {
     string path = string.Format("v1/Events/{0}", id);
     return
         Execute(
             new HttpRequestMessage(HttpMethod.Put, path)
             {
                 Content =
                     new StringContent(
                         JsonConvert.SerializeObject(eventModel),
                         Encoding.UTF8,
                         "application/json"),
             },
             token);
 }
Exemplo n.º 3
0
 /// <summary>
 ///     Creates the event.
 /// </summary>
 /// <param name="eventModel">The event model.</param>
 /// <param name="token">The token.</param>
 /// <returns></returns>
 public Task<GriklyHttpResponseMessage<CreateEventResponse>> CreateEvent(EventModel eventModel,
     CancellationToken token)
 {
     string path = "v1/Events";
     return
         Execute<CreateEventResponse>(
             new HttpRequestMessage(HttpMethod.Post, path)
             {
                 Content =
                     new StringContent(
                         JsonConvert.SerializeObject(eventModel),
                         Encoding.UTF8,
                         "application/json"),
             },
             token);
 }