public void Can_Get_Tasks_For_Date_Range() { _service.InsertTask(Scaffold.Task(Guid.NewGuid(), DateTime.Now.AddDays(-1))); List <WorkflowTaskPoco> result = _service.GetAllTasksForDateRange(DateTime.Now.AddDays(-2)); Assert.NotNull(result); Assert.Single(result); _service.InsertTask(Scaffold.Task(Guid.NewGuid(), DateTime.Now.AddDays(-10))); result = _service.GetAllTasksForDateRange(DateTime.Now.AddDays(-20)); Assert.NotNull(result); Assert.Equal(2, result.Count); }
public IHttpActionResult GetAllTasksForDateRange(int days) { try { List <WorkflowTaskInstancePoco> taskInstances = _tasksService.GetAllTasksForDateRange(DateTime.Now.AddDays(days * -1)); return(Json(new { items = taskInstances, total = taskInstances.Count }, ViewHelpers.CamelCase)); } catch (Exception ex) { const string msg = "Error getting tasks for date range"; Log.Error(msg, ex); return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg))); } }