/// <summary> /// Obtém ambientes de Lab do TFS /// </summary> /// <param name="lab">Lab Service</param> /// <param name="teamProjectName">Nome do Team project</param> /// <returns>Coleção de LabEnvironments</returns> public static ICollection <LabEnvironment> GetLabEnvironments(this LabService lab, string teamProjectName) { LabEnvironmentQuerySpec labSpec = new LabEnvironmentQuerySpec(); labSpec.Project = teamProjectName; ICollection <LabEnvironment> environments = lab.QueryLabEnvironments(labSpec); return(environments); }
/// <summary> /// Remove um ambiente de LAB /// </summary> /// <param name="labService"></param> /// <param name="tfsProjectName"></param> /// <param name="environmentName"></param> private void RemoveLabEnvironment(LabService labService, string tfsProjectName, string environmentName) { var labEnvironmentQuerySpec = new LabEnvironmentQuerySpec(); labEnvironmentQuerySpec.Project = tfsProjectName; labEnvironmentQuerySpec.Disposition = LabEnvironmentDisposition.Active; var labEnvironments = labService.QueryLabEnvironments(labEnvironmentQuerySpec); foreach (LabEnvironment env in labEnvironments) { if (env.Name == environmentName) { Console.WriteLine("Excluindo ambiente lab '" + environmentName + "'."); env.Destroy(); } } }