< Summary

Information
Class: UIBlazor.Services.Settings.CommonSettingsProvider
Assembly: UIBlazor
File(s): /home/runner/work/InvAit/InvAit/UIBlazor/Services/Settings/CommonSettingsProvider.cs
Tag: 71_26091983037
Line coverage
0%
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 30
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
AfterInitAsync()0%2040%
ResetAsync()100%210%

File(s)

/home/runner/work/InvAit/InvAit/UIBlazor/Services/Settings/CommonSettingsProvider.cs

#LineLine coverage
 1using System.Globalization;
 2
 3namespace UIBlazor.Services.Settings;
 4
 5public class CommonSettingsProvider(
 6    ILocalStorageService storage,
 7    ILogger<CommonSettingsProvider> logger)
 08    : BaseSettingsProvider<CommonOptions>(storage, logger, "CommonSettings"), ICommonSettingsProvider
 9{
 10    protected override async Task AfterInitAsync()
 11    {
 012        if (Current.Culture.Length != 5)
 13        {
 14            // Превратит "en" в "en-US", "ru" в "ru-RU" на основе системных данных
 015            Current.Culture = CultureInfo.CreateSpecificCulture(Current.Culture).Name;
 16        }
 17
 18        // Переходный период с 0.0.12 версии. Там было 3 сек и ничего не успевало.
 019        if (Current.ToolTimeoutMs < 20_000)
 20        {
 021            await ResetAsync();
 22        }
 023    }
 24
 25    public override async Task ResetAsync()
 26    {
 027        Current.ToolTimeoutMs = 120_000;
 028        await SaveAsync();
 029    }
 30}