From d7c8d8eeb48bd6baad54c1cb3504589c8c5588ab Mon Sep 17 00:00:00 2001 From: Bo Date: Wed, 30 Jan 2019 14:44:53 -0800 Subject: [PATCH] Remove some change --- .../Build/BuildsSample.cs | 101 +----------------- 1 file changed, 4 insertions(+), 97 deletions(-) diff --git a/ClientLibrary/Snippets/Microsoft.TeamServices.Samples.Client/Build/BuildsSample.cs b/ClientLibrary/Snippets/Microsoft.TeamServices.Samples.Client/Build/BuildsSample.cs index aef00e3..499bce4 100644 --- a/ClientLibrary/Snippets/Microsoft.TeamServices.Samples.Client/Build/BuildsSample.cs +++ b/ClientLibrary/Snippets/Microsoft.TeamServices.Samples.Client/Build/BuildsSample.cs @@ -1,5 +1,4 @@ using Microsoft.TeamFoundation.Build.WebApi; -using Microsoft.TeamServices.Samples.Client.Build; using Microsoft.VisualStudio.Services.WebApi; using System; using System.Collections.Generic; @@ -11,8 +10,9 @@ namespace Microsoft.TeamServices.Samples.Client.Build { [ClientSample(BuildResourceIds.AreaName, BuildResourceIds.BuildsResource)] public class BuildsSample : ClientSample - { + { [ClientSampleMethod] + public IEnumerable ListBuildDefinitions() { string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name; @@ -28,14 +28,14 @@ namespace Microsoft.TeamServices.Samples.Client.Build do { IPagedList buildDefinitionsPage = buildClient.GetDefinitionsAsync2( - project: projectName, + project: projectName, continuationToken: continuationToken).Result; buildDefinitions.AddRange(buildDefinitionsPage); continuationToken = buildDefinitionsPage.ContinuationToken; } while (!String.IsNullOrEmpty(continuationToken)); - + // Show the build definitions foreach (BuildDefinitionReference definition in buildDefinitions) { @@ -44,98 +44,5 @@ namespace Microsoft.TeamServices.Samples.Client.Build return buildDefinitions; } - - [ClientSampleMethod] - public BuildArtifact CreateArtifact() - { - BuildArtifact result = new BuildArtifact(); - // Get a build client instance - VssConnection connection = Context.Connection; - BuildHttpClient buildClient = connection.GetClient(); - - ArtifactResource newArtifactResource = new ArtifactResource() - { - Type = "new ArtifactResource type", - Data = "new ArtifactResource Data", - Properties = null, - Url = "new Url", - DownloadUrl = "new DownloadUrl", - DownloadTicket = "new downloadticket" - }; - - - BuildArtifact newArtifact = new BuildArtifact() - { - Id = 900, - Name = "New test artifact", - Resource = newArtifactResource - }; - - BuildArtifact newArtifact2 = new BuildArtifact() - { - Id = 901, - Name = "New test artifact 2", - Resource = newArtifactResource - }; - - try - { - result = buildClient.CreateArtifactAsync(newArtifact, 1).Result; - result = buildClient.CreateArtifactAsync(newArtifact2, 1).Result; - - Console.WriteLine("success"); - Console.WriteLine("{0}", newArtifact.Name); - } - catch(Exception ex) - { - Console.WriteLine("failed"); - Console.WriteLine("Error creating artifact: " + ex.InnerException.Message); - } - - - return result; - } - - [ClientSampleMethod] - public List GetAllArtifacts() - { - // Get a build client instance - VssConnection connection = Context.Connection; - BuildHttpClient buildClient = connection.GetClient(); - - List artifactsList = buildClient.GetArtifactsAsync(1).Result; - - return artifactsList; - } - - [ClientSampleMethod] - public BuildArtifact GetArtifact() - { - VssConnection connection = Context.Connection; - BuildHttpClient buildClient = connection.GetClient(); - - BuildArtifact result = buildClient.GetArtifactAsync("Test Project", 1, "New test artifact").Result; - - return result; - } - - [ClientSampleMethod] - public void GetFile() - { - System.Diagnostics.Debugger.Launch(); - VssConnection connection = Context.Connection; - BuildHttpClient buildClient = connection.GetClient(); - - //int buildId, string artifactName, string fileId, string fileName - try - { - var result = buildClient.GetFileAsync(1, "New test artifact", "1", "test file").Result; - Console.WriteLine("Get file successed"); - } - catch(Exception e) - { - Console.WriteLine("Get File failed: " + e.Message); - } - } } }