feat(domain): Product entity + 5 domain exceptions (PRD-002)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user