예제 #1
0
        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
        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
        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;
        }