< Summary - pva.SuperV

Information
Class: pva.SuperV.Api.Mappers.FieldFormatterMapper
Assembly: pva.SuperV.Api
File(s): /home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Mappers/FieldFormatterMapper.cs
Tag: dotnet-ubuntu_22190969454
Line coverage
80%
Covered lines: 8
Uncovered lines: 2
Coverable lines: 10
Total lines: 24
Line coverage: 80%
Branch coverage
50%
Covered branches: 2
Total branches: 4
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%2280%
FromDto(...)50%2280%

File(s)

/home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Api/Mappers/FieldFormatterMapper.cs

#LineLine coverage
 1using pva.SuperV.Engine.Exceptions;
 2using pva.SuperV.Engine.FieldFormatters;
 3using pva.SuperV.Model.FieldDefinitions;
 4using pva.SuperV.Model.FieldFormatters;
 5
 6namespace pva.SuperV.Api.Mappers
 7{
 8    public static class FieldFormatterMapper
 9    {
 10        public static FieldFormatterModel ToDto(FieldFormatter fieldFormatter)
 11911            => fieldFormatter switch
 11912            {
 11913                EnumFormatter enumFormatter => new EnumFormatterModel(enumFormatter.Name!, enumFormatter.Values!),
 014                _ => throw new UnhandledMappingException(nameof(FieldDefinitionMapper), fieldFormatter.GetType().ToStrin
 11915            };
 16
 17        public static FieldFormatter FromDto(FieldFormatterModel fieldFormatterModel)
 418            => fieldFormatterModel switch
 419            {
 420                EnumFormatterModel enumFormatterModel => new EnumFormatter(enumFormatterModel.Name!, enumFormatterModel.
 021                _ => throw new UnhandledMappingException(nameof(FieldDefinitionMapper), fieldFormatterModel.GetType().To
 422            };
 23    }
 24}