< Summary - Estud

Information
Class: Estud.Back.Features.Identity.GetRole.GetRoleService
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Features/Identity/GetRole/GetRoleService.cs
Tag: 114_29044117136
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 20
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Get()100%22100%

File(s)

/home/runner/work/syki/syki/Back/Features/Identity/GetRole/GetRoleService.cs

#LineLine coverage
 1namespace Estud.Back.Features.Identity.GetRole;
 2
 63public class GetRoleService(EstudDbContext ctx) : IEstudService
 4{
 5    public async Task<OneOf<GetRoleOut, EstudError>> Get(int id)
 6    {
 67        var role = await ctx.Roles.AsNoTracking()
 68            .FirstOrDefaultAsync(r => r.OwnerId == ctx.RequestUser.InstitutionId && r.Id == id);
 89        if (role == null) return RoleNotFound.I;
 10
 411        return new GetRoleOut
 412        {
 413            Id = role.Id,
 414            Name = role.Name!,
 415            Description = role.Description,
 416            BaseType = role.BaseType,
 417            Permissions = role.Permissions,
 418        };
 619    }
 20}