< Summary

Information
Class: Syki.Back.Audit.AuditData
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Audit/AuditData.cs
Tag: 22_11348620282
Line coverage
93%
Covered lines: 15
Uncovered lines: 1
Coverable lines: 16
Total lines: 34
Line coverage: 93.7%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Name()100%11100%
get_Table()100%11100%
get_Schema()100%11100%
get_Changes()100%11100%
get_Values()100%11100%
.ctor()100%210%
.ctor(...)100%66100%
NewAsJson(...)100%11100%

File(s)

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

#LineLine coverage
 1using System.Text.Json;
 2using Audit.EntityFramework;
 3
 4namespace Syki.Back.Audit;
 5
 6/// <summary>
 7/// Guarda as informações da autoria de mudança em uma entidade.
 8/// </summary>
 9public class AuditData
 10{
 1521611    public string Name { get; set; }
 1521612    public string Table { get; set; }
 1521613    public string Schema { get; set; }
 1521614    public List<AuditChange> Changes { get; set; }
 1450615    public IDictionary<string, object> Values { get; set; }
 16
 017    public AuditData() { }
 18
 760819    private AuditData(EventEntry entry)
 20    {
 760821        Name = entry.Name;
 760822        Table = entry.Table;
 760823        Schema = entry.Schema;
 1470824        Changes = entry.Changes?.ConvertAll(x => new AuditChange(x)).Where(c => c.New?.ToString() != c.Old?.ToString()).
 760825        if (entry.Action == "Insert")
 689826            Values = entry.ColumnValues;
 760827    }
 28
 29    public static JsonDocument NewAsJson(EventEntry entry)
 30    {
 760831        var data = new AuditData(entry);
 760832        return JsonDocument.Parse(data.Serialize());
 33    }
 34}