Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Project" /> class.
        /// </summary>
        /// <param name="project">The project.</param>
        public Project(Api.Models.Project project)
        {
            Ensure.That(project).IsNotNull();

            Id   = project.ProjectId.ToString();
            Name = project.Name;
        }
Ejemplo n.º 2
0
        private static Uri GetWebUrl(Api.Models.Project project, Api.Models.Build build)
        {
            var builder = new UriBuilder(UriUtility.BaseUri)
            {
                Path = $"project/{project.AccountName}/{project.Slug}/build/{build.Version}"
            };

            return(builder.Uri);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Build" /> class.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="build">The build.</param>
        public Build(Api.Models.Project project, Api.Models.Build build)
        {
            Ensure.That(project).IsNotNull();
            Ensure.That(build).IsNotNull();

            Id          = build.BuildId.ToString();
            Version     = build.Version;
            Number      = null;
            Branch      = build.Branch;
            StartTime   = build.Started?.ToUniversalTime();
            EndTime     = build.Finished?.ToUniversalTime();
            Status      = GetStatus(build);
            RequestedBy = build.AuthorUsername;
            WebUrl      = GetWebUrl(project, build);
            Changes     = new[]
            {
                new Change(build.CommitId, build.Committed?.ToUniversalTime(), build.CommitterName, build.Message?.Trim())
            };
        }