예제 #1
0
        public void TestFindProject()
        {
            Guid expectedProjectId = new Guid("abcdeff61-d357-42c8-a339-8b80824pqrst");

            azureContext.FindProject(projectName);
            TeamProjectReference defaultProject = azureContext.GetDefaultProject();

            Assert.IsNotNull(defaultProject);
            Assert.IsTrue(expectedProjectId.Equals(defaultProject.Id));
        }
        public static WorkItemClassificationNode ListAreas(this AzureContext azureContext)
        {
            int depth = 2;

            return(azureContext.GetHttpClientWorkItem().GetClassificationNodeAsync(
                       azureContext.GetDefaultProject().Name,
                       TreeStructureGroup.Areas,
                       null,
                       depth).Result);
        }
예제 #3
0
        public static IEnumerable <WebApiTeam> GetTeams(this AzureContext context)
        {
            IEnumerable <WebApiTeam> teams;

            using (new ClientSampleHttpLoggerOutputSuppression(context)) {
                teams = context.GetHttpClientTeam().GetTeamsAsync(projectId: context.GetDefaultProject().Id.ToString()).Result;
            }

            return(teams);
        }
        public static WorkItemClassificationNode ListIterations(this AzureContext azureContext)
        {
            int depth = 4;

            WorkItemClassificationNode rootIterationNode = azureContext.GetHttpClientWorkItem().GetClassificationNodeAsync(
                azureContext.GetDefaultProject().Name,
                TreeStructureGroup.Iterations,
                null,
                depth).Result;

            ShowNodeTree(rootIterationNode);

            return(rootIterationNode);
        }
예제 #5
0
        public static IEnumerable <TeamMember> GetAllTeamMembers(this AzureContext context)
        {
            List <TeamMember> allMembers = new List <TeamMember>();

            TeamHttpClient teamClient       = context.GetHttpClientTeam();
            string         defaultProjectId = context.GetDefaultProject().Id.ToString();

            foreach (WebApiTeam team in context.GetTeams())
            {
                allMembers.AddRange(teamClient.GetTeamMembersWithExtendedPropertiesAsync(defaultProjectId, team.Id.ToString()).Result);
            }

            return(allMembers.Where(item => !item.Identity.Inactive).GroupBy(item => item.Identity.Id).Select(groupedItem => groupedItem.First()));
        }
        public static WorkItemClassificationNode GetIteration(this AzureContext azureContext)
        {
            Guid   projectId;
            string iterationPath;

            // Get values from previous sample method that created a sample iteration
            //azureContext.TryGetValue<Guid>("$newIterationProjectId", out projectId);
            projectId = azureContext.GetDefaultProject().Id;
            azureContext.TryGetValue <string>("$newIterationName", out iterationPath);

            return(azureContext.GetHttpClientWorkItem().GetClassificationNodeAsync(
                       projectId.ToString(),
                       TreeStructureGroup.Iterations,
                       iterationPath,
                       4).Result);
        }
 public static WorkItem CreateIssue(this AzureContext azureContext, IEnumerable <JsonPatchItem> itemValues)
 {
     return(azureContext.GetHttpClientWorkItem().CreateWorkItemAsync(itemValues.ToJsonPatchDocument(), azureContext.GetDefaultProject().Name, "Issue").Result);
 }