< Summary - Combined Code Coverage

Information
Class: NLightning.Infrastructure.Crypto.Factories.CryptoFactory
Assembly: NLightning.Infrastructure
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure/Crypto/Factories/CryptoFactory.cs
Tag: 30_15166811759
Line coverage
60%
Covered lines: 3
Uncovered lines: 2
Coverable lines: 5
Total lines: 37
Line coverage: 60%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetCryptoProvider()100%1.13150%
GetCryptoProvider()100%1.13150%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure/Crypto/Factories/CryptoFactory.cs

#LineLine coverage
 1namespace NLightning.Infrastructure.Crypto.Factories;
 2
 3using Interfaces;
 4#if CRYPTO_JS
 5using Domain.Exceptions;
 6#endif
 7
 8internal static class CryptoFactory
 9{
 10    public static ICryptoProvider GetCryptoProvider()
 11    {
 12        try
 13        {
 14#if CRYPTO_JS
 15            if (OperatingSystem.IsBrowser())
 16            {
 17                return new Providers.JS.SodiumJsCryptoProvider();
 18            }
 19            else
 20            {
 21                throw new CriticalException("This provider is only available in a browser.");
 22            }
 23#elif CRYPTO_LIBSODIUM
 355824            return new Providers.Libsodium.SodiumCryptoProvider();
 25#elif CRYPTO_NATIVE
 355826        return new Providers.Native.NativeCryptoProvider();
 27#else
 28        throw new NotImplementedException("You have to set one of the compiler flags in order to use this factory.");
 29#endif
 30        }
 31        catch (Exception e)
 32        {
 033            Console.Write(e.StackTrace);
 034            throw;
 35        }
 711636    }
 37}