public JsonResult GetTasks( TasksSearchQuery data )
        {
            TasksService tasksService = new TasksService( Shared.API_KEY );
            List<Task> allTasks = new List<Task>();
            Task[] tasks = null;
            BusyTask[] startedAndCompleted = null,
                started = null,
                completed = null;

            foreach( var item in data.Workspaces )
            {
                tasks = tasksService.GetTasks( new TasksQuery() { AssigneeId = Shared.Me.Id, WorkspaceId = item, ReturnCompleteTaskRecords = true } );
                if( tasks != null && tasks.Length > 0 )
                {
                    allTasks.AddRange( tasks );
                }
            }

            GetTasks( DateTime.Parse( data.Start ), DateTime.Parse( data.End ), allTasks, out startedAndCompleted, out started, out completed );

            TasksSearchResults results = new TasksSearchResults()
            {
                StartedDuringRange = started,
                CompletedDuringRange = completed,
                StartedAndCompletedDuringRange = startedAndCompleted
            };
            return Json( results );
        }
Exemple #2
0
 public void GetAllMyTasksWithDetails()
 {
     TasksService taskService = new TasksService( API_KEY );
     Task[] tasks = taskService.GetTasks( new TasksQuery() { AssigneeId = TEST_USER_ID, WorkspaceId = TEST_WORKSPACE_ID, ReturnCompleteTaskRecords = true } );
     Assert.IsNotNull( tasks, "we should have gotten some tasks back" );
     foreach( var item in tasks )
     {
         Assert.AreNotEqual( DateTime.MinValue, item.CreatedAt, "Since ReturnCompleteTaskRecords is true, CreatedAt should come back" );
     }
 }
Exemple #3
0
        public void GetTasksInProject()
        {
            TasksService taskService = new TasksService( API_KEY );
            Task[] tasks = taskService.GetTasks( new TasksQuery() { ProjectId = TEST_PROJECT_ID } );
            Assert.IsNotNull( tasks, "we should have gotten some tasks back" );
            Assert.IsTrue( tasks.Length > 0, "task.Length should be > 0, but it was " + tasks.Length.ToString() );
            foreach( var item in tasks )
            {
                Assert.AreEqual( DateTime.MinValue, item.CreatedAt, "Since ReturnCompleteTaskRecords is false, CreatedAt shouldn't come back" );
            }

            Task[] tasks2 = taskService.GetTasksInProject( TEST_PROJECT_ID );
            Assert.IsNotNull( tasks2, "we should have gotten some tasks back" );
            Assert.IsTrue( tasks2.Length > 0, "task.Length should be > 0, but it was " + tasks2.Length.ToString() );
            foreach( var item in tasks2 )
            {
                Assert.AreEqual( DateTime.MinValue, item.CreatedAt, "Since ReturnCompleteTaskRecords is false, CreatedAt shouldn't come back" );
            }

            CompareTasks( tasks, tasks2 );
        }