feat(domain): Product entity + 5 domain exceptions (PRD-002)

This commit is contained in:
2026-04-19 12:59:58 -03:00
parent 0462970ea1
commit 16197cf242
8 changed files with 530 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
using FluentAssertions;
using SIGCM2.Domain.Exceptions;
namespace SIGCM2.Application.Tests.Products.Exceptions;
/// <summary>
/// PRD-002 — Tests for new Product domain exceptions.
/// Verifies message content and property values.
/// </summary>
public class ProductExceptionsTests
{
[Fact]
public void ProductNotFoundException_ContainsId_InMessage()
{
var ex = new ProductNotFoundException(5);
ex.Message.Should().Contain("5");
ex.ProductId.Should().Be(5);
}
[Fact]
public void ProductNombreDuplicadoEnMedioTipoException_ContainsDetails()
{
var ex = new ProductNombreDuplicadoEnMedioTipoException(2, 3, "Clasificado");
ex.Message.Should().Contain("Clasificado");
ex.Message.Should().Contain("2");
ex.Message.Should().Contain("3");
ex.MedioId.Should().Be(2);
ex.ProductTypeId.Should().Be(3);
ex.Nombre.Should().Be("Clasificado");
}
[Fact]
public void ProductTipoFlagsIncoherentesException_FieldAndMessage()
{
var ex = new ProductTipoFlagsIncoherentesException("requiere RubroId", "rubroId");
ex.Field.Should().Be("rubroId");
ex.Message.Should().Contain("requiere RubroId");
}
[Fact]
public void ProductTypeInactivoException_ContainsProductTypeId()
{
var ex = new ProductTypeInactivoException(7);
ex.Message.Should().Contain("7");
ex.ProductTypeId.Should().Be(7);
}
[Fact]
public void RubroInactivoException_ContainsRubroId()
{
var ex = new RubroInactivoException(12);
ex.Message.Should().Contain("12");
ex.RubroId.Should().Be(12);
}
}