• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

samsmithnz / RepoAutomation / 3851196580

pending completion
3851196580

push

github

GitHub
Merge pull request #210 from samsmithnz/ConvertedPercentsToWholeNumber

314 of 450 branches covered (69.78%)

Branch coverage included in aggregate %.

767 of 866 relevant lines covered (88.57%)

7.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.85
/src/RepoAutomation.Core/Models/Release.cs
1
using System.Text;
2

3
namespace RepoAutomation.Core.Models
4
{
5
    public class Release : BaseModel
6
    {
7
        public string? id { get; set; }
2✔
8
        public string? name { get; set; }
4✔
9
        public string? tag_name { get; set; }
2✔
10
        public DateTime? published_at { get; set; }
4✔
11
        public string? html_url { get; set; }
2✔
12
        public Asset[]? assets { get; set; }
2✔
13

14
        public string ToTimingString()
15
        {
1✔
16
            if (published_at != null)
1!
17
            {
1✔
18
                StringBuilder sb = new();
1✔
19
                sb.Append(" (");
1✔
20
                TimeSpan span = DateTime.Now - (DateTime)published_at;
1✔
21
                if (span.TotalMinutes < 0) //Happens when the timezone messes with the published at date.
1!
22
                {
×
23
                    sb.Append("a few moments");
×
24
                }
×
25
                else if (span.TotalMinutes < 60)
1!
26
                {
×
27
                    sb.Append(span.TotalMinutes.ToString("0"));
×
28
                    sb.Append(" minutes");
×
29
                }
×
30
                else if (span.TotalHours < 24)
1!
31
                {
×
32
                    sb.Append(span.TotalHours.ToString("0"));
×
33
                    sb.Append(" hours");
×
34
                }
×
35
                else if (span.TotalDays <= 30) //approximation
1!
36
                {
×
37
                    sb.Append(span.TotalDays.ToString("0"));
×
38
                    sb.Append(" days");
×
39
                }
×
40
                else
41
                {
1✔
42
                    sb.Append((span.TotalDays / 30).ToString("0"));
1✔
43
                    sb.Append(" months");
1✔
44
                }
1✔
45
                sb.Append(" ago) ");
1✔
46

47
                return sb.ToString();
1✔
48
            }
49
            else
50
            {
×
51
                return "";
×
52
            }
53

54
        }
1✔
55

56
        public class Asset
57
        {
58
            public string? name { get; set; }
×
59
            public string? browser_download_url { get; set; }
×
60
        }
61

62
    }
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc