< Summary

Information
Class: EF.Blockchain.Server.Mappers.BlockInfoMapper
Assembly: EF.Blockchain.Server
File(s): C:\dev\@web3\web3-001-ef-blockchain\backend\EF.Blockchain\src\EF.Blockchain.Server\Mappers\BlockInfoMapper.cs
Line coverage
93%
Covered lines: 15
Uncovered lines: 1
Coverable lines: 16
Total lines: 27
Line coverage: 93.7%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ToDto(...)50%6693.75%

File(s)

C:\dev\@web3\web3-001-ef-blockchain\backend\EF.Blockchain\src\EF.Blockchain.Server\Mappers\BlockInfoMapper.cs

#LineLine coverage
 1using EF.Blockchain.Domain;
 2using EF.Blockchain.Server.Dtos;
 3
 4namespace EF.Blockchain.Server.Mappers;
 5
 6public static class BlockInfoMapper
 7{
 8    public static BlockInfoDto ToDto(BlockInfo domain)
 89    {
 810        if (domain == null)
 011            return null;
 12
 813        var transactions = domain.Transactions?
 814            .Select(TransactionMapper.ToDto)
 815            .ToList() ?? new List<TransactionDto>();
 16
 817        return new BlockInfoDto
 818        {
 819            Index = domain.Index,
 820            PreviousHash = domain.PreviousHash,
 821            Difficulty = domain.Difficulty,
 822            MaxDifficulty = domain.MaxDifficulty,
 823            FeePerTx = domain.FeePerTx,
 824            Transactions = transactions
 825        };
 826    }
 27}