< Summary

Information
Class: Fluorite.Strainer.Services.Conversion.TypeChanger
Assembly: Fluorite.Strainer
File(s): /builds/fluorite/strainer/src/Strainer/Services/Conversion/TypeChanger.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 26
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
ChangeType(...)100%210%

File(s)

/builds/fluorite/strainer/src/Strainer/Services/Conversion/TypeChanger.cs

#LineLine coverage
 1using Fluorite.Strainer.Exceptions;
 2
 3namespace Fluorite.Strainer.Services.Conversion;
 4
 5public class TypeChanger : ITypeChanger
 6{
 7    public object ChangeType(string value, Type targetType)
 8    {
 09        Guard.Against.Null(value);
 010        Guard.Against.Null(targetType);
 11
 12        try
 13        {
 014            return Convert.ChangeType(value, targetType);
 15        }
 016        catch (Exception ex)
 17        {
 018            throw new StrainerConversionException(
 019                $"Failed to change type of filter value '{value}' " +
 020                $"to type '{targetType.FullName}'.",
 021                ex,
 022                value,
 023                targetType);
 24        }
 025    }
 26}