< Summary

Information
Class: FAU.DataAccess.Repositories.EscalafonRepository
Assembly: FAU.DataAccess
File(s): /home/runner/work/Sistema.Liquidacion.BE/Sistema.Liquidacion.BE/FAU.DataAccess/Repositories/EscalafonRepository.cs
Line coverage
100%
Covered lines: 22
Uncovered lines: 0
Coverable lines: 22
Total lines: 51
Line coverage: 100%
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%11100%
ObtenerTodosAsync()100%11100%
ObtenerPorIdAsync()100%11100%
CrearAsync()100%11100%
ActualizarAsync()100%11100%
ExisteCodigoAsync()100%11100%
ExistePorIdAsync()100%11100%

File(s)

/home/runner/work/Sistema.Liquidacion.BE/Sistema.Liquidacion.BE/FAU.DataAccess/Repositories/EscalafonRepository.cs

#LineLine coverage
 1using FAU.Entidades;
 2using Microsoft.EntityFrameworkCore;
 3
 4namespace FAU.DataAccess.Repositories;
 5
 6public class EscalafonRepository : IEscalafonRepository
 7{
 8    private readonly ApplicationDbContext _context;
 9
 810    public EscalafonRepository(ApplicationDbContext context)
 11    {
 812        _context = context;
 813    }
 14
 15    public async Task<IEnumerable<Escalafon>> ObtenerTodosAsync()
 16    {
 117        return await _context.Escalafones
 118            .Where(e => e.Vigente)
 119            .OrderBy(e => e.Denominacion)
 120            .ToListAsync();
 121    }
 22
 23    public async Task<Escalafon?> ObtenerPorIdAsync(long id)
 24    {
 325        return await _context.Escalafones.FirstOrDefaultAsync(e => e.Id == id);
 326    }
 27
 28    public async Task<Escalafon> CrearAsync(Escalafon escalafon)
 29    {
 730        _context.Escalafones.Add(escalafon);
 731        await _context.SaveChangesAsync();
 732        return escalafon;
 733    }
 34
 35    public async Task<Escalafon> ActualizarAsync(Escalafon escalafon)
 36    {
 137        _context.Escalafones.Update(escalafon);
 138        await _context.SaveChangesAsync();
 139        return escalafon;
 140    }
 41
 42    public async Task<bool> ExisteCodigoAsync(string codigo)
 43    {
 244        return await _context.Escalafones.AnyAsync(e => e.Codigo == codigo);
 245    }
 46
 47    public async Task<bool> ExistePorIdAsync(long id)
 48    {
 149        return await _context.Escalafones.AnyAsync(e => e.Id == id);
 150    }
 51}