示例#1
0
        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 );
        }
示例#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" );
     }
 }
示例#3
0
        public void GetStories()
        {
            TasksService ts = new TasksService( API_KEY );
            Task t = ts.GetTasksInProject( TEST_PROJECT_ID )[ 0 ];

            StoriesService service = new StoriesService( API_KEY );
            Story[] stories = service.GetStories( t );
            Assert.IsNotNull( stories, "we should have gotten some stories back" );
            Assert.IsTrue( stories.Length > 0, "stories.Length  was only " + stories.Length.ToString() );
            foreach( var item in stories )
            {
                Assert.IsNotNull( item.Text, "text should always come back" );
                Assert.IsTrue( item.Type.HasValue, "type should always be populated" );
                Assert.IsNotNull( item.CreatedBy, "CreatedBy should be back now" );
            }
        }
示例#4
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 );
        }