public IActionResult UpdateUpdateQueueItemStatus([FromRoute] int id, [FromBody] UpdateQueueItemStatusRequest request) { try { var facade = new QueueFacade(); var response = facade.UpdateQueueItemStatus(id, request); switch (response.Status) { case HttpStatusCode.OK: return(Ok()); case HttpStatusCode.BadRequest: return(BadRequest(BuildBadRequestMessage(response))); case HttpStatusCode.NotFound: return(NotFound()); case HttpStatusCode.InternalServerError: return(StatusCode(StatusCodes.Status500InternalServerError)); } s_logger.Fatal("This code should be unreachable, unknown result has occured."); } catch (Exception ex) { s_logger.Error(ex, "Unable to update queue item status."); } return(StatusCode(StatusCodes.Status500InternalServerError)); }
public void UpdateQueueItemStatusBothTimesNull() { var request = new UpdateQueueItemStatusRequest { TimeHelped = null, TimeRemoved = null }; var queueFacade = new QueueFacade(); var response = queueFacade.UpdateQueueItemStatus(-1, request); // Check that a request containing both TimeHelped and TimeRemoved is rejected. Assert.AreEqual(HttpStatusCode.BadRequest, response.Status); }
public void UpdateQueueItemStatusBothTimesNotNull() { DateTime timeHelped = DateTime.Now; DateTime timeRemoved = timeHelped.AddMinutes(1); var request = new UpdateQueueItemStatusRequest { TimeHelped = timeHelped, TimeRemoved = timeRemoved }; var queueFacade = new QueueFacade(); var response = queueFacade.UpdateQueueItemStatus(-1, request); // Check that a request containing both TimeHelped and TimeRemoved is rejected. Assert.AreEqual(HttpStatusCode.BadRequest, response.Status); }
public void UpdateQueueItemStatusDoesNotExist() { DateTime timeHelped = DateTime.Now; var request = new UpdateQueueItemStatusRequest { TimeHelped = timeHelped, TimeRemoved = null }; var queueFacade = new QueueFacade(); var response = queueFacade.UpdateQueueItemStatus(-1, request); // Check that a request containing both TimeHelped and TimeRemoved is rejected. Assert.AreEqual(HttpStatusCode.NotFound, response.Status); }