public TodoResults GetAllUnfinishedItems() { TodoResults itemsResults = new TodoResults(); itemsResults.results = _dummyData.AllItems().Where(t => t.IsFinished == false && t.IsDeleted != true).ToList(); itemsResults.status = itemsResults.results.Any() ? OperationStatusCodes.SUCCESS : OperationStatusCodes.NOT_FOUND; return(itemsResults); }
public TodoResults GetTodoItemsForGiveTimePeriod(int timePeriod) { TodoResults itemsResults = new TodoResults(); DateTime fromDate = DateTime.Today; DateTime toDate = DateTime.Today.AddDays(timePeriod); if (timePeriod <= 1) { itemsResults.status = OperationStatusCodes.INVALID_PARAMTERS; return(itemsResults); } itemsResults.results = _dummyData.AllItems().Where(t => t.StartDate >= fromDate && t.EndDate <= toDate && t.IsDeleted != true).ToList(); if (!itemsResults.results.Any()) { itemsResults.status = OperationStatusCodes.NOT_FOUND; return(itemsResults); } itemsResults.status = OperationStatusCodes.SUCCESS; return(itemsResults); }
public void GetAllUnfinishedItems_ItemsFound_ReturnList() { TodoResults result = _todoItemOperator.GetAllUnfinishedItems(); Assert.IsTrue(result.status == OperationStatusCodes.SUCCESS); }
public void GetAllFinishedItems_NoItemsFound_ReturnNotFound() { TodoResults result = _todoItemOperator.GetAllFinishedItems(); Assert.IsTrue(result.status == OperationStatusCodes.NOT_FOUND); }
public void GetTodoItemsForGiveTimePeriod_ItemsFound_ReturnList() { TodoResults result = _todoItemOperator.GetTodoItemsForGiveTimePeriod(2); Assert.IsTrue(result.status == OperationStatusCodes.SUCCESS); }
public void GetTodoItemsForGiveTimePeriod_InvalidPeriod_ReturnFail() { TodoResults result = _todoItemOperator.GetTodoItemsForGiveTimePeriod(0); Assert.IsTrue(result.status == OperationStatusCodes.INVALID_PARAMTERS); }