Files
SIG-CM2.0/tests/SIGCM2.Application.Tests/Domain/Pricing/ChargeableChars/ChargeableCharConfigReactivationNotAllowedExceptionTests.cs
dmolinari f7fb76219a refactor+feat(backend): ChargeableCharConfig por ProductType + Reactivate + Delete endpoints (PRC-001)
Part A — MedioId → ProductTypeId rename across all C# layers:
  Domain, Application, Infrastructure, API, all test projects.
  Solution was non-compilable after BD refactor (5c1675e); now compiles clean (0 errors).

Part B — PATCH /api/v1/admin/chargeable-chars/{id}/reactivate:
  ReactivateChargeableCharConfigCommand/Handler, SP guard maps 50410/50411/50412
  → ChargeableCharConfigReactivationNotAllowedException(Reason) → HTTP 409.

Part C — DELETE /api/v1/admin/chargeable-chars/{id}:
  DeleteChargeableCharConfigCommand/Handler, physical DELETE on SYSTEM_VERSIONED table.
  KeyNotFoundException → 404 via ExceptionFilter.

Tests: +30 unit tests (TDD RED→GREEN). All 1266 unit tests pass.
2026-04-21 10:54:47 -03:00

33 lines
1016 B
C#

using FluentAssertions;
using SIGCM2.Domain.Pricing.Exceptions;
namespace SIGCM2.Application.Tests.Domain.Pricing.ChargeableChars;
/// <summary>
/// PRC-001 — Unit tests for ChargeableCharConfigReactivationNotAllowedException.
/// </summary>
public sealed class ChargeableCharConfigReactivationNotAllowedExceptionTests
{
[Theory]
[InlineData("ALREADY_ACTIVE")]
[InlineData("VIGENTE_EXISTS")]
[InlineData("POSTERIOR_ROWS_EXIST")]
public void Constructor_SetsIdAndReason(string reason)
{
var ex = new ChargeableCharConfigReactivationNotAllowedException(42L, reason);
ex.Id.Should().Be(42L);
ex.Reason.Should().Be(reason);
ex.Message.Should().Contain("42");
ex.Message.Should().Contain(reason);
}
[Fact]
public void Exception_IsDomainException()
{
var ex = new ChargeableCharConfigReactivationNotAllowedException(1L, "ALREADY_ACTIVE");
ex.Should().BeAssignableTo<SIGCM2.Domain.Exceptions.DomainException>();
}
}