Example #1
0
        /// <summary>
        ///   Returns a Collection of all TeamCity Build Configuartions of the specified <paramref name = "project" />
        /// </summary>
        /// <param name = "project">The Project</param>
        /// <returns>A Collection of <see cref = "TeamCityBuildConfiguration" /></returns>
        public IEnumerable<TeamCityBuildConfiguration> GetBuildConfigurations(TeamCityProject project)
        {
            Uri uri = this.connection.CreateUri(project.Href);

            XmlProject xmlProject = this.connection.Request<XmlProject>(uri);

            foreach (XmlBuildType xmlBuildType in xmlProject.BuildType.BuildType)
            {
                Uri buildTypeUri = this.connection.CreateUri(xmlBuildType.Href);

                XmlDetailedBuildType detailedBuildType = this.connection.Request<XmlDetailedBuildType>(buildTypeUri);

                yield return new TeamCityBuildConfiguration(detailedBuildType);
            }
        }
Example #2
0
        /// <summary>
        ///   Searches for the <see cref = "TeamCityBuildConfiguration" /> with in name <paramref name = "configurationName" /> in the project specified by <paramref name = " teamCityProject" />
        /// </summary>
        /// <param name = "teamCityProject">The project to look at</param>
        /// <param name = "configurationName">The name of the build configuration</param>
        /// <returns>An instance of <see cref = "TeamCityBuildConfiguration" /> if a Buildconfiguraiton for the specified names was found; otherwise <c>null</c></returns>
        public TeamCityBuildConfiguration FindBuildConfiguration(TeamCityProject teamCityProject,
            string configurationName)
        {
            foreach (
                TeamCityBuildConfiguration teamCityBuildConfiguration in
                    this.GetBuildConfigurations(teamCityProject))
            {
                if (teamCityBuildConfiguration.Name.Equals(configurationName,
                                                           StringComparison.Ordinal))
                {
                    return (teamCityBuildConfiguration);
                }
            }

            return (null);
        }