< Summary - Estud

Information
Class: Estud.Back.Domain.Webhooks.WebhookCall
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Domain/Webhooks/WebhookCall.cs
Tag: 114_29044117136
Line coverage
100%
Covered lines: 30
Uncovered lines: 0
Coverable lines: 30
Total lines: 48
Line coverage: 100%
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%11100%
get_InstitutionId()100%11100%
get_WebhookSubscriptionId()100%11100%
get_Payload()100%11100%
get_EventType()100%11100%
get_Status()100%11100%
get_AttemptsCount()100%11100%
get_CreatedAt()100%11100%
get_Attempts()100%11100%
.ctor()100%11100%
.ctor(...)100%11100%
Success(...)100%11100%
Failed(...)100%11100%

File(s)

/home/runner/work/syki/syki/Back/Domain/Webhooks/WebhookCall.cs

#LineLine coverage
 1namespace Estud.Back.Domain.Webhooks;
 2
 3/// <summary>
 4/// Chamada de Webhook
 5/// </summary>
 6public class WebhookCall
 7{
 468    public int Id { get; set; }
 369    public int InstitutionId { get; set; }
 3610    public int WebhookSubscriptionId { get; set; }
 3611    public string Payload { get; set; }
 2812    public WebhookEventType EventType { get; set; }
 5213    public WebhookCallStatus Status { get; set; }
 5014    public int AttemptsCount { get; set; }
 2815    public DateTime CreatedAt { get; set; }
 2416    public List<WebhookCallAttempt> Attempts { get; set; }
 17
 10418    private WebhookCall() { }
 19
 1820    public WebhookCall(
 1821        int institutionId,
 1822        int webhookSubscriptionId,
 1823        object data,
 1824        WebhookEventType eventType)
 25    {
 1826        InstitutionId = institutionId;
 1827        WebhookSubscriptionId = webhookSubscriptionId;
 1828        Payload = (new { EventType = eventType, Data = data }).Serialize();
 1829        EventType = eventType;
 1830        CreatedAt = DateTime.UtcNow;
 1831        Status = WebhookCallStatus.Pending;
 1832    }
 33
 34    public void Success(int statusCode, string response)
 35    {
 1636        AttemptsCount++;
 1637        Status = WebhookCallStatus.Success;
 1638        Attempts.Add(new WebhookCallAttempt(Id, WebhookCallAttemptStatus.Success, statusCode, response));
 1639    }
 40
 41    public void Failed(int statusCode, string response)
 42    {
 243        Status = WebhookCallStatus.Error;
 244        Attempts.Add(new WebhookCallAttempt(Id, WebhookCallAttemptStatus.Error, statusCode, response));
 45
 246        AttemptsCount++;
 247    }
 48}