コード例 #1
0
            private Task <WorkItemQueryResult> QuerySingleBatchAsync(int id)
            {
                var fullWhereClause = $@"[{FieldNames.TeamProject}] = @Project AND [{FieldNames.Id}] > {
                        id
                    } {_extraWhereClause} ORDER BY [{FieldNames.Id}]";
                var query           = $"SELECT [{FieldNames.Id}] FROM WorkItems WHERE {fullWhereClause}";

                return(_client.PostAsync(WorkItemTracking.QueryByWiql(_project, _batchSize), new QueryByWiql(query)));
            }
コード例 #2
0
        public async Task QueryByWiql_ShouldReturnResults()
        {
            // Arrange

            // Act
            var result = await _client.PostAsync(WorkItemTracking.QueryByWiql(_config.Project, 1),
                                                 new QueryByWiql("select [System.Id] from WorkItems"));

            // Assert
            result.ShouldNotBeNull();
            result.WorkItems.ShouldNotBeEmpty();
            result.WorkItems.First().Id.ShouldNotBe(default);
コード例 #3
0
        public async Task GetSingle_ShouldReturnWorkItem()
        {
            // Arrange
            var queryResult = await _client.PostAsync(WorkItemTracking.QueryByWiql(_config.Project, 1),
                                                      new QueryByWiql($"select [System.Id] from WorkItems"));

            var workItem = queryResult.WorkItems.First();
            var fields   = new[] { FieldNames.TeamProject };

            // Act
            var result =
                await _client.GetAsync(WorkItemTracking.GetWorkItem(_config.Project, workItem.Id, fields,
                                                                    queryResult.AsOf));

            // Assert
            result.ShouldNotBeNull();
            result.Id.ShouldBe(workItem.Id);
            result.Fields.ShouldNotBeNull();
            result.Fields.ShouldContainKey(FieldNames.TeamProject);
            result.Fields[FieldNames.TeamProject].ShouldNotBeNull();
        }