< Summary - Syki

Information
Class: Syki.Shared.Auth.FeaturesStore
Assembly: Shared
File(s): /home/runner/work/syki/syki/Shared/Auth/ExatoFeaturesStore.cs
Tag: 36_19195353031
Line coverage
100%
Covered lines: 39
Uncovered lines: 0
Coverable lines: 39
Total lines: 56
Line coverage: 100%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()50%88100%

File(s)

/home/runner/work/syki/syki/Shared/Auth/ExatoFeaturesStore.cs

#LineLine coverage
 1using System.Reflection;
 2
 3namespace Syki.Shared.Auth;
 4
 5public static class FeaturesStore
 6{
 27    public static readonly SykiFeature ViewUsers = new(0, 0, "Ver usuários.");
 28    public static readonly SykiFeature CreateUser = new(0, 1, "Criar usuário.");
 29    public static readonly SykiFeature ViewRoles = new(0, 2, "Ver roles.");
 210    public static readonly SykiFeature CreateRole = new(0, 3, "Criar role.");
 211    public static readonly SykiFeature UpdateRole = new(0, 4, "Editar role.");
 212    public static readonly SykiFeature ViewFeatures = new(0, 5, "Ver features.");
 213    public static readonly SykiFeature ViewPolicies = new(0, 6, "Ver policies.");
 214    public static readonly SykiFeature ViewAuditTrails = new(0, 7, "Ver audit trails.");
 215    public static readonly SykiFeature ViewAuditTrailDetails = new(0, 8, "Ver detalhes de um audit trail.");
 16
 217    public static readonly SykiFeature ViewDomainEvents = new(1, 9, "Ver eventos de domínio.");
 218    public static readonly SykiFeature ViewDomainEventDetails = new(1, 10, "Ver detalhes de um evento de domínio.");
 219    public static readonly SykiFeature ViewCommands = new(1, 11, "Ver comandos.");
 220    public static readonly SykiFeature ViewCommandDetails = new(1, 12, "Ver detalhes de um comando.");
 221    public static readonly SykiFeature ReprocessCommand = new(1, 13, "Reprocessar um comando.");
 222    public static readonly SykiFeature ViewCommandBatches = new(1, 14, "Ver lotes de comandos.");
 223    public static readonly SykiFeature ViewCommandBatchDetails = new(1, 15, "Ver detalhes de um lote de comandos.");
 24
 225    public static readonly SykiFeature ViewInstitutions = new(2, 16, "Ver instituições de ensino.");
 226    public static readonly SykiFeature CreateInstitution = new(2, 17, "Criar instituição de ensino.");
 227    public static readonly SykiFeature ViewInstitutionDetails = new(2, 18, "Ver detalhes de uma instituição de ensino.")
 28
 229    public static readonly List<FeatureGroup> Groups = [];
 230    public static readonly List<SykiFeature> Features = [];
 31    static FeaturesStore()
 32    {
 233        Groups =
 234        [
 235            new(0, "Users"),
 236            new(1, "Daemon"),
 237            new(2, "Instituições"),
 238        ];
 39
 240        Features = typeof(FeaturesStore)
 241            .GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
 4242            .Where(f => f.FieldType == typeof(SykiFeature))
 3843            .Select(f => (SykiFeature)f.GetValue(null)!)
 3844            .OrderBy(f => f.GroupId)
 3845                .ThenBy(f => f.Id)
 246            .ToList();
 47
 10448        if (Features.Any(x => Groups.FirstOrDefault(g => g.Id == x.GroupId) == null)) throw new Exception("Invalid group
 49
 4050        if (!Features.Select(x => x.Id).IsAllDistinct()) throw new Exception("Duplicated feature ids!");
 51
 4052        if (!Features.Select(x => x.Name).IsAllDistinct()) throw new Exception("Duplicated feature names!");
 53
 4054        if (Features.Count - 1 != Features.OrderByDescending(x => x.Id).First().Id) throw new Exception("Wrong ids!");
 255    }
 56}

Methods/Properties

.cctor()