Adds unit tests improving domain project code coverage

This commit is contained in:
BinaryAlley committed 2026-09-02 06:56:36 -07:00
1 parent 208f102070
commit 0ec6eb7ab4
25 files changed
+1577 -12

No files matched your search

@@ -85,6 +85,31 @@ public class EntityIdTests
Assert.Equal(firstHashCode, secondHashCode);
}
[Fact]
public void GetEqualityComponents_WhenNotOverridden_ShouldYieldOnlyTheValue()
{
// Arrange
Guid value = Guid.NewGuid();
DefaultEntityId entityId = new(value);
// Act
IEnumerable<object?> components = entityId.GetEqualityComponents();
// Assert
object? component = Assert.Single(components);
Assert.Equal(value, component);
}
[Fact]
public void Constructor_WhenCalledWithoutArguments_ShouldLeaveValueAsDefault()
{
// Act
DefaultEntityId entityId = new();
// Assert
Assert.Equal(default, entityId.Value);
}
/// <summary>
/// Concrete test implementation of the abstract <see cref="EntityId{TId}"/> class.
/// </summary>
@@ -107,4 +132,25 @@ public class EntityIdTests
yield return Value;
}
}
/// <summary>
/// Concrete test implementation of the abstract <see cref="EntityId{TId}"/> class that relies on the base equality components.
/// </summary>
private sealed class DefaultEntityId : EntityId<Guid>
{
/// <summary>
/// Initializes a new instance of the <see cref="DefaultEntityId"/> class.
/// </summary>
/// <param name="value">The value representing this object.</param>
public DefaultEntityId(Guid value) : base(value)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultEntityId"/> class.
/// </summary>
public DefaultEntityId() : base()
{
}
}
}