< Summary

Information
Class: FAU.Logica.Validadores.FechaIngresoValidator
Assembly: FAU.Logica
File(s): /home/runner/work/Sistema.Liquidacion.BE/Sistema.Liquidacion.BE/FAU.Logica/Validadores/FechaIngresoValidator.cs
Line coverage
87%
Covered lines: 7
Uncovered lines: 1
Coverable lines: 8
Total lines: 26
Line coverage: 87.5%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
ValidarNoEsFutura(...)100%11100%
ObtenerErrorSiEsFutura(...)75%4480%

File(s)

/home/runner/work/Sistema.Liquidacion.BE/Sistema.Liquidacion.BE/FAU.Logica/Validadores/FechaIngresoValidator.cs

#LineLine coverage
 1namespace FAU.Logica.Validadores;
 2
 3/// <summary>
 4/// Validador para la fecha de ingreso del personal
 5/// </summary>
 6public static class FechaIngresoValidator
 7{
 18    private static readonly DateTime FechaMinima = new DateTime(1950, 1, 1);
 9
 10    public static bool ValidarNoEsFutura(DateTime fechaIngreso)
 11    {
 412        var hoy = DateTime.UtcNow.Date;
 413        return fechaIngreso.Date <= hoy;
 14    }
 15
 16    public static string? ObtenerErrorSiEsFutura(DateTime fechaIngreso)
 17    {
 418        if (!ValidarNoEsFutura(fechaIngreso))
 119            return $"La fecha de ingreso no puede ser futura. Fecha ingresada: {fechaIngreso:dd/MM/yyyy}";
 20
 321        if (fechaIngreso.Date < FechaMinima)
 022            return $"La fecha de ingreso no puede ser anterior a {FechaMinima:dd/MM/yyyy}. Fecha ingresada: {fechaIngres
 23
 324        return null;
 25    }
 26}