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

loresoft / KickStart / 17529667504

07 Sep 2025 02:14PM UTC coverage: 60.921%. Remained the same
17529667504

push

github

pwelter34
reformat code base

162 of 364 branches covered (44.51%)

Branch coverage included in aggregate %.

634 of 951 new or added lines in 72 files covered. (66.67%)

4 existing lines in 4 files now uncovered.

658 of 982 relevant lines covered (67.01%)

20.4 hits per line

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

56.52
/src/KickStart.DependencyInjection/DependencyInjectionRegistration.cs
1
using KickStart.Services;
2

3
using Microsoft.Extensions.DependencyInjection;
4

5
using ServiceLifetime = KickStart.Services.ServiceLifetime;
6

7
namespace KickStart.DependencyInjection;
8

9
/// <summary>
10
/// Microsoft.Extensions.DependencyInjection implementation for <see cref="IServiceRegistration"/>.
11
/// </summary>
12
/// <seealso cref="IServiceRegistration" />
13
public class DependencyInjectionRegistration : ServiceRegistrationBase
14
{
15
    private readonly IServiceCollection _container;
16

17
    /// <summary>
18
    /// Initializes a new instance of the <see cref="DependencyInjectionRegistration"/> class.
19
    /// </summary>
20
    /// <param name="container">The container.</param>
21
    /// <param name="serviceContext">The current service <see cref="Context"/>.</param>
22
    public DependencyInjectionRegistration(Context serviceContext, IServiceCollection container) : base(serviceContext)
3✔
23
    {
24
        _container = container;
3✔
25
    }
3✔
26

27

28
    /// <summary>
29
    /// Registers a service of the type specified in <paramref name="serviceType" /> with an
30
    /// implementation of the type specified in <paramref name="implementationType" /> using
31
    /// the specified <paramref name="lifetime" />.
32
    /// </summary>
33
    /// <param name="serviceType">The type of the service to register.</param>
34
    /// <param name="implementationType">The implementation type of the service.</param>
35
    /// <param name="lifetime">The service lifetime.</param>
36
    /// <returns>
37
    /// A reference to this instance after the operation has completed.
38
    /// </returns>
39
    public override IServiceRegistration Register(Type serviceType, Type implementationType, ServiceLifetime lifetime)
40
    {
41
        if (lifetime == ServiceLifetime.Singleton)
25!
42
            _container.AddSingleton(serviceType, implementationType);
25✔
NEW
43
        else if (lifetime == ServiceLifetime.Scoped)
×
NEW
44
            _container.AddScoped(serviceType, implementationType);
×
45
        else
NEW
46
            _container.AddTransient(serviceType, implementationType);
×
47

48
        return this;
25✔
49
    }
50

51
    /// <summary>
52
    /// Registers a service of the type specified in <paramref name="serviceType" /> with a
53
    /// factory specified in <paramref name="implementationFactory" /> using
54
    /// the specified <paramref name="lifetime" />.
55
    /// </summary>
56
    /// <param name="serviceType">The type of the service to register.</param>
57
    /// <param name="implementationFactory">The factory that creates the service.</param>
58
    /// <param name="lifetime">The service lifetime.</param>
59
    /// <returns>
60
    /// A reference to this instance after the operation has completed.
61
    /// </returns>
62
    /// <seealso cref="F:KickStart.Services.ServiceLifetime.Singleton" />
63
    public override IServiceRegistration Register(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
64
    {
65
        if (lifetime == ServiceLifetime.Singleton)
1!
NEW
66
            _container.AddSingleton(serviceType, implementationFactory);
×
67
        else if (lifetime == ServiceLifetime.Scoped)
1!
NEW
68
            _container.AddScoped(serviceType, implementationFactory);
×
69
        else
70
            _container.AddTransient(serviceType, implementationFactory);
1✔
71

72
        return this;
1✔
73
    }
74
}
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