< Summary - Estud

Information
Class: Estud.Back.Audit.AuditTrail
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Audit/AuditTrail.cs
Tag: 114_29044117136
Line coverage
95%
Covered lines: 19
Uncovered lines: 1
Coverable lines: 20
Total lines: 44
Line coverage: 95%
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
get_Id()100%210%
get_ActivityId()100%11100%
get_Operation()100%11100%
get_EntityId()100%11100%
get_EntityType()100%11100%
get_UserId()100%11100%
get_InstitutionId()100%11100%
get_Action()100%11100%
get_CreatedAt()100%11100%
get_Data()100%11100%
Fill(...)100%11100%

File(s)

/home/runner/work/syki/syki/Back/Audit/AuditTrail.cs

#LineLine coverage
 1using Audit.Core;
 2using System.Text.Json;
 3using Audit.EntityFramework;
 4
 5namespace Estud.Back.Audit;
 6
 7/// <summary>
 8/// Guarda os dados de auditoria de uma entidade.
 9/// </summary>
 10public class AuditTrail
 11{
 012    public int Id { get; set; }
 13
 435614    public string ActivityId { get; set; }
 435615    public string Operation { get; set; }
 16
 435617    public string EntityId { get; set; }
 435618    public string EntityType { get; set; }
 19
 435620    public int UserId { get; set; }
 435621    public int InstitutionId { get; set; }
 22
 435623    public string Action { get; set; }
 435624    public DateTime CreatedAt { get; set; }
 435625    public JsonDocument Data { get; set; }
 26
 27    public bool Fill(AuditEvent evt, EventEntry entry)
 28    {
 435629        ActivityId = evt.ActivityId;
 435630        Operation = evt.Operation;
 31
 435632        EntityId = entry.PrimaryKey.First().Value.ToString()!;
 435633        EntityType = entry.EntityType.Name;
 34
 435635        UserId = evt.UserId;
 435636        InstitutionId = evt.InstitutionId;
 37
 435638        Action = entry.Action;
 435639        CreatedAt = DateTime.UtcNow;
 435640        Data = AuditData.NewAsJson(entry);
 41
 435642        return true;
 43    }
 44}