< Summary - Estud

Information
Class: Estud.Back.Audit.AuditData
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Audit/AuditData.cs
Tag: 114_29044117136
Line coverage
93%
Covered lines: 14
Uncovered lines: 1
Coverable lines: 15
Total lines: 33
Line coverage: 93.3%
Branch coverage
100%
Covered branches: 8
Total branches: 8
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%88100%
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 Estud.Back.Audit;
 5
 6/// <summary>
 7/// Guarda as informações da autoria de mudança de uma entidade.
 8/// </summary>
 9public class AuditData
 10{
 871211    public string Name { get; set; }
 871212    public string Table { get; set; }
 871213    public string Schema { get; set; }
 871214    public List<AuditChange> Changes { get; set; }
 621415    public IDictionary<string, object> Values { get; set; }
 16
 017    public AuditData() { }
 18
 435619    private AuditData(EventEntry entry)
 20    {
 435621        Name = entry.Name;
 435622        Table = entry.Table;
 435623        Schema = entry.Schema;
 621424        if (entry.Action == "Insert") Values = entry.ColumnValues;
 3522425        Changes = entry.Changes?.ConvertAll(x => new AuditChange(x)).Where(c => c.New?.ToString() != c.Old?.ToString()).
 435626    }
 27
 28    public static JsonDocument NewAsJson(EventEntry entry)
 29    {
 435630        var data = new AuditData(entry);
 435631        return JsonDocument.Parse(data.Serialize());
 32    }
 33}