< Summary

Information
Class: Services.BackgroundJobsServices.RussianTimeZoneHelper
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/BackgroundJobsServices/RussianTimeZoneHelper.cs
Line coverage
33%
Covered lines: 4
Uncovered lines: 8
Coverable lines: 12
Total lines: 34
Line coverage: 33.3%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
get_Zone()100%11100%
Resolve()100%2120%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/BackgroundJobsServices/RussianTimeZoneHelper.cs

#LineLine coverage
 1namespace Services.BackgroundJobsServices;
 2
 3/// <summary>
 4/// Московское время для cron Hangfire (Windows / Linux / macOS).
 5/// </summary>
 6public static class RussianTimeZoneHelper
 7{
 28    private static readonly Lazy<TimeZoneInfo> ZoneLazy = new(Resolve, LazyThreadSafetyMode.ExecutionAndPublication);
 9
 115310    public static TimeZoneInfo Zone => ZoneLazy.Value;
 11
 12    private static TimeZoneInfo Resolve()
 13    {
 14        try
 15        {
 216            return TimeZoneInfo.FindSystemTimeZoneById("Europe/Moscow");
 17        }
 018        catch
 19        {
 20            try
 21            {
 022                return TimeZoneInfo.FindSystemTimeZoneById("Russian Standard Time");
 23            }
 024            catch
 25            {
 026                return TimeZoneInfo.CreateCustomTimeZone(
 027                    "UTC+3",
 028                    TimeSpan.FromHours(3),
 029                    "UTC+3",
 030                    "UTC+3");
 31            }
 32        }
 233    }
 34}

Methods/Properties

.cctor()
get_Zone()
Resolve()