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

thorstenalpers / CleanMyPosts / 15154413111

21 May 2025 05:39AM UTC coverage: 14.069% (+14.1%) from 0.0%
15154413111

push

github

thorstenalpers
Add unit tests

46 of 286 branches covered (16.08%)

Branch coverage included in aggregate %.

39 of 108 new or added lines in 7 files covered. (36.11%)

1 existing line in 1 file now uncovered.

121 of 901 relevant lines covered (13.43%)

0.32 hits per line

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

0.0
/src/UI/Services/UpdateService.cs
1
using Ardalis.GuardClauses;
2
using CleanMyPosts.UI.Contracts.Services;
3
using CleanMyPosts.UI.Models;
4
using Microsoft.Extensions.Logging;
5
using Microsoft.Extensions.Options;
6
using NetSparkleUpdater;
7
using NetSparkleUpdater.Interfaces;
8
using NetSparkleUpdater.SignatureVerifiers;
9

10
namespace CleanMyPosts.UI.Services;
11

12
public class UpdateService : IUpdateService
13
{
14
    private readonly SparkleUpdater _sparkle;
15
    private readonly ILogger<UpdateService> _logger;
16

17
    public UpdateService(IOptions<UpdaterOptions> options,
×
18
                         IUIFactory uIFactory,
×
NEW
19
                         IDeploymentService deploymentService,
×
20
                         ILogger<UpdateService> logger,
×
21
                         NetSparkleUpdater.Interfaces.ILogger netSparkleLogger)
×
22
    {
23
        _logger = logger;
×
24
        var opts = options.Value;
×
25

26
        Guard.Against.Null(opts);
×
27
        Guard.Against.NullOrWhiteSpace(opts.AppCastUrlSingle);
×
28
        Guard.Against.NullOrWhiteSpace(opts.AppCastUrlInstaller);
×
29
        Guard.Against.NullOrWhiteSpace(opts.SecurityMode.ToString());
×
30

NEW
31
        var url = deploymentService.IsRunningAsInstalled() ? opts.AppCastUrlInstaller : opts.AppCastUrlSingle;
×
32
        var verifier = new DSAChecker(opts.SecurityMode.Value);
×
33
        _logger.LogInformation("Update url is {Url}.", url);
×
34
        _sparkle = new SparkleUpdater(url, verifier)
×
35
        {
×
36
            UIFactory = uIFactory,
×
37
            RelaunchAfterUpdate = true,
×
38
            LogWriter = netSparkleLogger
×
39
        };
×
40
    }
×
41

42
    public async Task CheckForUpdatesAsync()
43
    {
44
        try
45
        {
46
            await _sparkle.CheckForUpdatesAtUserRequest();
×
47
        }
×
48
        catch (Exception ex)
×
49
        {
50
            _logger.LogError(ex, "Error while checking for updates.");
×
51
        }
×
52
    }
×
53
}
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