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

JaCraig / SerialBox / 11993385331

24 Nov 2024 05:11AM UTC coverage: 68.75% (-0.4%) from 69.118%
11993385331

push

github

JaCraig
chore: merge

48 of 90 branches covered (53.33%)

Branch coverage included in aggregate %.

95 of 118 relevant lines covered (80.51%)

5.69 hits per line

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

41.67
/SerialBox/Registration/Register.cs
1
/*
2
Copyright 2016 James Craig
3

4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7

8
    http://www.apache.org/licenses/LICENSE-2.0
9

10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16

17
using Canister.Interfaces;
18
using Microsoft.Extensions.DependencyInjection;
19
using SerialBox.Interfaces;
20
using System.Reflection;
21

22
namespace SerialBox.Registration
23
{
24
    /// <summary>
25
    /// Registration extension methods
26
    /// </summary>
27
    public static class Registration
28
    {
29
        /// <summary>
30
        /// Registers the library with the bootstrapper.
31
        /// </summary>
32
        /// <param name="bootstrapper">The bootstrapper.</param>
33
        /// <returns>The bootstrapper</returns>
34
        public static ICanisterConfiguration? RegisterSerialBox(this ICanisterConfiguration? bootstrapper) => bootstrapper?.AddAssembly(typeof(Registration).GetTypeInfo().Assembly);
×
35

36
        /// <summary>
37
        /// Registers the SerialBox services with the specified IServiceCollection.
38
        /// </summary>
39
        /// <param name="services">The IServiceCollection to add the services to.</param>
40
        /// <returns>The IServiceCollection with the registered services.</returns>
41
        public static IServiceCollection? RegisterSerialBox(this IServiceCollection? services)
42
        {
43
            if (services.Exists<SerialBox>())
1!
44
                return services;
×
45
            return services?.AddAllTransient<ISerializer>()?.AddSingleton<SerialBox>();
1!
46
        }
47
    }
48
}
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