< Summary - MechanicsSoftware — Coverage Report

Information
Class: MechanicsSoftware.Domain.Entities.Budget
Assembly: MechanicsSoftware.Domain
File(s): /home/runner/work/mechanics-software/mechanics-software/src/MechanicsSoftware.Domain/Entities/Budget.cs
Line coverage
94%
Covered lines: 18
Uncovered lines: 1
Coverable lines: 19
Total lines: 39
Line coverage: 94.7%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
Create(...)50%2291.66%
Approve()100%11100%
Reject()100%11100%

File(s)

/home/runner/work/mechanics-software/mechanics-software/src/MechanicsSoftware.Domain/Entities/Budget.cs

#LineLine coverage
 1using MechanicsSoftware.Domain.Exceptions;
 2using MechanicsSoftware.Domain.ValueObjects;
 3
 4namespace MechanicsSoftware.Domain.Entities;
 5
 6public sealed class Budget : Entity<Guid>
 7{
 8    public Guid ServiceOrderId { get; private set; }
 9    public Money Total { get; private set; } = null!;
 10    public BudgetStatus Status { get; private set; } = null!;
 11    public DateTime CreatedAt { get; private set; }
 12
 33013    private Budget() { }
 14
 15    internal static Budget Create(Guid serviceOrderId, Money total)
 9416    {
 9417        if (total is null)
 018            throw new DomainException("Budget total is required.");
 19
 9420        return new Budget
 9421        {
 9422            Id = Guid.NewGuid(),
 9423            ServiceOrderId = serviceOrderId,
 9424            Total = total,
 9425            Status = BudgetStatus.CreatePending(),
 9426            CreatedAt = DateTime.UtcNow
 9427        };
 9428    }
 29
 30    internal void Approve()
 4831    {
 4832        Status = Status.TransitionTo(BudgetStatus.Status.Approved);
 4833    }
 34
 35    internal void Reject()
 1636    {
 1637        Status = Status.TransitionTo(BudgetStatus.Status.Rejected);
 1638    }
 39}