< Summary

Information
Class: Enjoy.Domain.Shared.Primitives.Entity
Assembly: Enjoy.Domain
File(s): D:\Dotnet\Propuesta-trabajo\Enjoy Project\EnjoyApp\Enjoy\src\Enjoy.Domain\Shared\Primitives\Entity.cs
Line coverage
100%
Covered lines: 18
Uncovered lines: 0
Coverable lines: 18
Total lines: 37
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

D:\Dotnet\Propuesta-trabajo\Enjoy Project\EnjoyApp\Enjoy\src\Enjoy.Domain\Shared\Primitives\Entity.cs

#LineLine coverage
 1namespace Enjoy.Domain.Shared.Primitives;
 2
 3public abstract class Entity : IEquatable<Entity>
 4{
 1915    public string Id { get; init; }
 6
 1607    protected Entity(string id) => Id = id;
 8
 9    // Requerido para EF Core
 1510    protected Entity() { }
 11
 12    public override bool Equals(object? obj)
 413    {
 414        if (obj is Entity other)
 215        {
 216            return Equals(other);
 17        }
 18
 219        return false;
 420    }
 21
 22    public bool Equals(Entity? other)
 1023    {
 1124        if (other is null) return false;
 1125        if (other.GetType() != GetType()) return false;
 1126        if (ReferenceEquals(this, other)) return true;
 327        return Equals(Id, other.Id);
 1028    }
 29
 230    public override int GetHashCode() => Id.GetHashCode() * 41;
 31
 32    public static bool operator ==(Entity? first, Entity? second) =>
 433        first is not null && first.Equals(second);
 34
 35    public static bool operator !=(Entity? first, Entity? second) =>
 236        !(first == second);
 37}