< Summary

Class:Microsoft.Extensions.DependencyInjection.AddAkkaExtensions
Assembly:SeungYongShim.Akka.DependencyInjection
File(s):/home/runner/work/SeungYongShim.Akka/SeungYongShim.Akka/src/SeungYongShim.Akka.DependencyInjection/AddAkkaExtensions.cs
Covered lines:13
Uncovered lines:0
Coverable lines:13
Total lines:32
Line coverage:100% (13 of 13)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)
Tag:81_945672945

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AddAkka(...)0%110100%

File(s)

/home/runner/work/SeungYongShim.Akka/SeungYongShim.Akka/src/SeungYongShim.Akka.DependencyInjection/AddAkkaExtensions.cs

#LineLine coverage
 1using System;
 2using Akka.Actor;
 3using Akka.Actor.Setup;
 4using Akka.Configuration;
 5using Akka.DependencyInjection;
 6using SeungYongShim.Akka;
 7using SeungYongShim.Akka.DependencyInjection.Abstractions;
 8
 9namespace Microsoft.Extensions.DependencyInjection
 10{
 11    public static class AddAkkaExtensions
 12    {
 13        internal static IServiceCollection AddAkka(this IServiceCollection services,
 14                                                   string actorSystemName,
 15                                                   string hocon,
 16                                                   Func<Config, Config> hoconFunc,
 17                                                   Action<IServiceProvider, ActorSystem> startAction = null) =>
 818            services.AddSingleton(sp =>
 1619            {
 1620                return BootstrapSetup.Create()
 1621                                     .WithConfig(hoconFunc(ConfigurationFactory.ParseString(hocon)))
 1622                                     .And(DependencyResolverSetup.Create(sp));
 1623            })
 1624            .AddSingleton<AkkaHostedServiceStart>(sp => sys =>
 2425            {
 2426                startAction?.Invoke(sp, sys);
 2427            })
 828            .AddSingleton(typeof(IPropsFactory<>), typeof(PropsFactory<>))
 829            .AddHostedService<AkkaHostedService>()
 930            .AddSingleton(sp => ActorSystem.Create(actorSystemName, sp.GetService<ActorSystemSetup>()));
 31    }
 32}