< Summary - MechanicsSoftware — Coverage Report

Information
Class: MechanicsSoftware.Domain.Entities.Entity<T>
Assembly: MechanicsSoftware.Domain
File(s): /home/runner/work/mechanics-software/mechanics-software/src/MechanicsSoftware.Domain/Entities/Entity.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 30
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
.ctor(...)100%11100%
Equals(...)100%66100%
GetHashCode()100%11100%
op_Equality(...)100%22100%
op_Inequality(...)100%11100%

File(s)

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

#LineLine coverage
 1namespace MechanicsSoftware.Domain.Entities;
 2
 3public abstract class Entity<TId>
 4{
 5    public TId Id { get; protected set; } = default!;
 6
 27907    protected Entity() { }
 8
 309    protected Entity(TId id)
 3010    {
 3011        Id = id;
 3012    }
 13
 14    public override bool Equals(object? obj)
 2415    {
 3016        if (obj is not Entity<TId> other) return false;
 2017        if (ReferenceEquals(this, other)) return true;
 1818        if (GetType() != other.GetType()) return false;
 1419        return EqualityComparer<TId>.Default.Equals(Id, other.Id);
 2420    }
 21
 22    public override int GetHashCode() =>
 823        HashCode.Combine(GetType(), Id);
 24
 25    public static bool operator ==(Entity<TId>? left, Entity<TId>? right) => // NOSONAR — intentional value equality for
 1026        left?.Equals(right) ?? right is null;
 27
 28    public static bool operator !=(Entity<TId>? left, Entity<TId>? right) =>
 429        !(left == right);
 30}