< Summary - Syki

Information
Class: Syki.Back.Domain.Webhooks.WebhookCall
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Domain/Webhooks/WebhookCall.cs
Tag: 97_27801654829
Line coverage
0%
Covered lines: 0
Uncovered lines: 29
Coverable lines: 29
Total lines: 47
Line coverage: 0%
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_InstitutionId()100%210%
get_WebhookId()100%210%
get_Payload()100%210%
get_EventType()100%210%
get_Status()100%210%
get_AttemptsCount()100%210%
get_CreatedAt()100%210%
get_Attempts()100%210%
.ctor()100%210%
.ctor(...)100%210%
Success(...)100%210%
Failed(...)100%210%

File(s)

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

#LineLine coverage
 1namespace Syki.Back.Domain.Webhooks;
 2
 3/// <summary>
 4/// Chamada de Webhook
 5/// </summary>
 6public class WebhookCall
 7{
 08    public int Id { get; set; }
 09    public int InstitutionId { get; set; }
 010    public int WebhookId { get; set; }
 011    public string Payload { get; set; }
 012    public WebhookEventType EventType { get; set; }
 013    public WebhookCallStatus Status { get; set; }
 014    public int AttemptsCount { get; set; }
 015    public DateTime CreatedAt { get; set; }
 016    public List<WebhookCallAttempt> Attempts { get; set; }
 17
 018    private WebhookCall() { }
 19
 020    public WebhookCall(
 021        int institutionId,
 022        int webhookId,
 023        object data,
 024        WebhookEventType eventType)
 25    {
 026        InstitutionId = institutionId;
 027        WebhookId = webhookId;
 028        Payload = (new { EventType = eventType, Data = data }).Serialize();
 029        EventType = eventType;
 030        CreatedAt = DateTime.UtcNow;
 031    }
 32
 33    public void Success(int statusCode, string response)
 34    {
 035        AttemptsCount++;
 036        Status = WebhookCallStatus.Success;
 037        Attempts.Add(new WebhookCallAttempt(Id, WebhookCallAttemptStatus.Success, statusCode, response));
 038    }
 39
 40    public void Failed(int statusCode, string response)
 41    {
 042        Status = WebhookCallStatus.Error;
 043        Attempts.Add(new WebhookCallAttempt(Id, WebhookCallAttemptStatus.Error, statusCode, response));
 44
 045        AttemptsCount++;
 046    }
 47}