< Summary - Syki

Information
Class: Syki.Back.Commands.Domain.Commands.CommandBatch
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Domain/Commands/CommandBatch.cs
Tag: 56_26538939494
Line coverage
0%
Covered lines: 0
Uncovered lines: 21
Coverable lines: 21
Total lines: 48
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_Type()100%210%
get_Status()100%210%
get_CreatedAt()100%210%
get_ProcessedAt()100%210%
get_SourceCommandId()100%210%
get_NextCommandId()100%210%
get_Size()100%210%
.ctor()100%210%
New(...)100%210%
ContinueWith(...)100%210%

File(s)

/home/runner/work/syki/syki/Back/Domain/Commands/CommandBatch.cs

#LineLine coverage
 1using Syki.Back.Domain.Enums;
 2
 3namespace Syki.Back.Commands.Domain.Commands;
 4
 5public class CommandBatch
 6{
 07    public int Id { get; set; }
 08    public int InstitutionId { get; set; }
 09    public CommandBatchType Type { get; set; }
 010    public CommandBatchStatus Status { get; set; }
 011    public DateTime CreatedAt { get; set; }
 012    public DateTime? ProcessedAt { get; set; }
 13
 14    /// <summary>
 15    /// Id do comando que gerou o lote
 16    /// </summary>
 017    public int? SourceCommandId { get; set; }
 18
 19    /// <summary>
 20    /// Id do comando que será executado quando o lote for processado com sucesso
 21    /// </summary>
 022    public int? NextCommandId { get; set; }
 23
 024    public int Size { get; set; }
 25
 026    private CommandBatch() { }
 27
 28    public static CommandBatch New(
 29        int institutionId,
 30        CommandBatchType type,
 31        int? sourceCommandId = null)
 32    {
 033        return new()
 034        {
 035            Type = type,
 036            CreatedAt = DateTime.UtcNow,
 037            InstitutionId = institutionId,
 038            Status = CommandBatchStatus.Pending,
 039            SourceCommandId = sourceCommandId,
 040        };
 41    }
 42
 43    public void ContinueWith(Command command)
 44    {
 045        NextCommandId = command.Id;
 046        command.SetAwaiting();
 047    }
 48}