< Summary - Combined Code Coverage

Information
Class: NLightning.Infrastructure.Transport.Factories.TransportServiceFactory
Assembly: NLightning.Infrastructure
File(s): /home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure/Transport/Factories/TransportServiceFactory.cs
Tag: 36_15743069263
Line coverage
0%
Covered lines: 0
Uncovered lines: 10
Coverable lines: 10
Total lines: 46
Line coverage: 0%
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
.ctor(...)100%210%
CreateTransportService(...)100%210%

File(s)

/home/runner/work/nlightning/nlightning/src/NLightning.Infrastructure/Transport/Factories/TransportServiceFactory.cs

#LineLine coverage
 1using System.Net.Sockets;
 2using Microsoft.Extensions.Logging;
 3using Microsoft.Extensions.Options;
 4
 5namespace NLightning.Infrastructure.Transport.Factories;
 6
 7using Domain.Node.Options;
 8using Domain.Protocol.Interfaces;
 9using Domain.Serialization.Interfaces;
 10using Domain.Transport;
 11using Infrastructure.Crypto.Interfaces;
 12using Services;
 13
 14/// <summary>
 15/// Factory for creating a transport service.
 16/// </summary>
 17/// <remarks>
 18/// This class is used to create a transport service in test environments.
 19/// </remarks>
 20public sealed class TransportServiceFactory : ITransportServiceFactory
 21{
 22    private readonly IEcdh _ecdh;
 23    private readonly ILoggerFactory _loggerFactory;
 24    private readonly IMessageSerializer _messageSerializer;
 25    private readonly NodeOptions _nodeOptions;
 26
 027    public TransportServiceFactory(IEcdh ecdh, ILoggerFactory loggerFactory, IMessageSerializer messageSerializer,
 028                                   IOptions<NodeOptions> nodeOptions)
 29    {
 030        _ecdh = ecdh;
 031        _loggerFactory = loggerFactory;
 032        _messageSerializer = messageSerializer;
 033        _nodeOptions = nodeOptions.Value;
 034    }
 35
 36    /// <inheritdoc />
 37    public ITransportService CreateTransportService(bool isInitiator, ReadOnlySpan<byte> s, ReadOnlySpan<byte> rs,
 38                                                    TcpClient tcpClient)
 39    {
 40        // Create a specific logger for the TransportService class
 041        var logger = _loggerFactory.CreateLogger<TransportService>();
 42
 043        return new TransportService(_ecdh, logger, _messageSerializer, _nodeOptions.NetworkTimeout, isInitiator, s, rs,
 044                                    tcpClient);
 45    }
 46}