コード例 #1
0
ファイル: WorkItemService.cs プロジェクト: chartek/teamboard
        public IList<BoardWorkItem> GetWorkItems(string projectName)
        {
            var workItemMappings = _config.WorkItemMappings[projectName];

            WorkItemQuery query = new WorkItemQuery(projectName, workItemMappings);
            query.AddColumn("Id");
            query.AddColumn("Summary");
            query.AddColumn("Description");
            query.AddColumn("Priority");

            query.AddSort("Priority", "ASC");

            return GetWorkItems(query, workItemMappings);
        }
コード例 #2
0
ファイル: QueryTests.cs プロジェクト: chartek/teamboard
        public void CanCreateValidQuery()
        {
            WorkItemQuery query = new WorkItemQuery("teamboard", new Dictionary<string, string>()
                        {
                            {"Id","System.Id"},
                            {"Summary", "System.Title"},
                            {"Description", "System.Description"},
                            {"Priority", "CodeStudio.Custom"},
                            {"Status", "System.State"}
                        });

            query.AddColumn("Id");
            query.AddColumn("Summary");
            query.AddColumn("Description");
            query.AddColumn("Priority");

            query.AddSort("Priority", "ASC");

            query.AddCriterion("Status", "<>", "Closed");

            Assert.Equal("SELECT [System.Id],[System.Title],[System.Description],[CodeStudio.Custom] FROM WorkItems WHERE [System.TeamProject] = 'teamboard' AND [System.State] <> 'Closed' ORDER BY [CodeStudio.Custom] ASC",
                query.ToString());
        }
コード例 #3
0
ファイル: WorkItemService.cs プロジェクト: chartek/teamboard
        private IList<BoardWorkItem> GetWorkItems(WorkItemQuery query, Dictionary<string, string> workItemMappings)
        {
            var workItems = new List<BoardWorkItem>();

            using (var tfs = GetServer())
            {
                tfs.EnsureAuthenticated();
                var workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));

                WorkItemCollection results = workItemStore.Query(query.ToString());
                foreach (TfsWorkItem
                    item in results)
                {
                    var newWorkItem = ConvertToBoardWorkItem(item, workItemMappings);
                    workItems.Add(newWorkItem);
                }
            }

            return workItems;
        }