< Summary - Syki

Line coverage
10%
Covered lines: 7
Uncovered lines: 57
Coverable lines: 64
Total lines: 307
Line coverage: 10.9%
Branch coverage
0%
Covered branches: 0
Total branches: 34
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

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

#LineLine coverage
 1using StronglyTypedIds;
 2
 3namespace Syki.Back.Commands;
 4
 5public class CommandBatch
 6{
 7    public CommandBatchId Id { get; set; }
 8    public Guid InstitutionId { get; set; }
 9    public CommandBatchType Type { get; set; }
 10    public CommandBatchStatus Status { get; set; }
 11    public DateTime CreatedAt { get; set; }
 12    public DateTime? ProcessedAt { get; set; }
 13
 14    /// <summary>
 15    /// Id do evento que gerou o lote
 16    /// </summary>
 17    public DomainEventId? EventId { get; set; }
 18
 19    /// <summary>
 20    /// Id do comando que gerou o lote
 21    /// </summary>
 22    public CommandId? SourceCommandId { get; set; }
 23
 24    /// <summary>
 25    /// Id do comando que será executado quando o lote for processado com sucesso
 26    /// </summary>
 27    public CommandId? NextCommandId { get; set; }
 28
 29    public int Size { get; set; }
 30
 31    private CommandBatch() { }
 32
 33    public static CommandBatch New(
 34        Guid institutionId,
 35        CommandBatchType type,
 36        DomainEventId? eventId = null,
 37        CommandId? sourceCommandId = null)
 38    {
 39        return new()
 40        {
 41            Type = type,
 42            Id = CommandBatchId.CreateNew(),
 43            CreatedAt = DateTime.UtcNow,
 44            InstitutionId = institutionId,
 45            Status = CommandBatchStatus.Pending,
 46            EventId = eventId,
 47            SourceCommandId = sourceCommandId,
 48        };
 49    }
 50
 51    public void ContinueWith(Command command)
 52    {
 53        NextCommandId = command.Id;
 54        command.SetAwaiting();
 55    }
 56}
 57
 58[StronglyTypedId]
 59public partial struct CommandBatchId
 60{
 61    public static CommandBatchId CreateNew()
 62    {
 063        return new CommandBatchId(Guid.CreateVersion7());
 64    }
 65
 66    public class CommandBatchIdEfCoreValueConverter : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConvert
 67    {
 868        public CommandBatchIdEfCoreValueConverter() : this(null) { }
 69
 70        public CommandBatchIdEfCoreValueConverter(Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMapping
 471            : base(
 472                id => id.Value,
 473                value => new CommandBatchId(value),
 474                mappingHints
 475            )
 476        { }
 77    }
 78}

/home/runner/work/syki/syki/Back/obj/Release/net10.0/StronglyTypedIds/StronglyTypedIds.StronglyTypedIdGenerator/Syki.Back.Commands.CommandBatchId.g.cs

File '/home/runner/work/syki/syki/Back/obj/Release/net10.0/StronglyTypedIds/StronglyTypedIds.StronglyTypedIdGenerator/Syki.Back.Commands.CommandBatchId.g.cs' does not exist (any more).

Methods/Properties

CreateNew()
.ctor()
.ctor(Microsoft.EntityFrameworkCore.Storage.ValueConversion.ConverterMappingHints)
get_Value()
.ctor(System.Guid)
New()
.cctor()
Equals(Syki.Back.Commands.CommandBatchId)
Equals(System.Object)
GetHashCode()
ToString()
op_Equality(Syki.Back.Commands.CommandBatchId,Syki.Back.Commands.CommandBatchId)
op_Inequality(Syki.Back.Commands.CommandBatchId,Syki.Back.Commands.CommandBatchId)
op_GreaterThan(Syki.Back.Commands.CommandBatchId,Syki.Back.Commands.CommandBatchId)
op_LessThan(Syki.Back.Commands.CommandBatchId,Syki.Back.Commands.CommandBatchId)
op_GreaterThanOrEqual(Syki.Back.Commands.CommandBatchId,Syki.Back.Commands.CommandBatchId)
op_LessThanOrEqual(Syki.Back.Commands.CommandBatchId,Syki.Back.Commands.CommandBatchId)
CompareTo(Syki.Back.Commands.CommandBatchId)
CanConvertFrom(System.ComponentModel.ITypeDescriptorContext,System.Type)
ConvertFrom(System.ComponentModel.ITypeDescriptorContext,System.Globalization.CultureInfo,System.Object)
CanConvertTo(System.ComponentModel.ITypeDescriptorContext,System.Type)
ConvertTo(System.ComponentModel.ITypeDescriptorContext,System.Globalization.CultureInfo,System.Object,System.Type)
Read(System.Text.Json.Utf8JsonReader&,System.Type,System.Text.Json.JsonSerializerOptions)
Write(System.Text.Json.Utf8JsonWriter,Syki.Back.Commands.CommandBatchId,System.Text.Json.JsonSerializerOptions)
ReadAsPropertyName(System.Text.Json.Utf8JsonReader&,System.Type,System.Text.Json.JsonSerializerOptions)
WriteAsPropertyName(System.Text.Json.Utf8JsonWriter,Syki.Back.Commands.CommandBatchId,System.Text.Json.JsonSerializerOptions)
Parse(System.String)
Parse(System.String,System.IFormatProvider)
TryParse(System.String,System.IFormatProvider,Syki.Back.Commands.CommandBatchId&)
ToString(System.String,System.IFormatProvider)
Parse(System.ReadOnlySpan`1<System.Char>)
Parse(System.ReadOnlySpan`1<System.Char>,System.IFormatProvider)
TryParse(System.ReadOnlySpan`1<System.Char>,System.IFormatProvider,Syki.Back.Commands.CommandBatchId&)
TryFormat(System.Span`1<System.Char>,System.Int32&,System.ReadOnlySpan`1<System.Char>,System.IFormatProvider)
TryFormat(System.Span`1<System.Char>,System.Int32&,System.ReadOnlySpan`1<System.Char>)
TryFormat(System.Span`1<System.Byte>,System.Int32&,System.ReadOnlySpan`1<System.Char>,System.IFormatProvider)