Files
satellite-provider/SatelliteProvider.Tests/AcceptanceCriteriaRT2Tests.cs
T
Oleksandr Bezdieniezhnykh 23ab05766d [AZ-370] Refactor C17: status / point-type enums + AC RT2 update
Replaces bare strings with two enums in Common/Enums/:
  RegionStatus { Queued, Processing, Completed, Failed }
  RoutePointType { Start, End, Action, Intermediate }

Adds a Dapper EnumStringTypeHandler<T> (DataAccess/TypeHandlers/)
that round-trips enums to/from lowercase strings, registered once
at startup via DapperEnumTypeHandlers.RegisterAll(). DataAccess now
references Common (project ref) so entities can carry the enum types.

Sites converted: RegionService (5), RouteProcessingService (3),
RoutePointGraphBuilder (4), entity Status/PointType columns. Log
message and summary file format preserved via .ToLowerInvariant().

API JSON contract preserved by adding JsonStringEnumConverter with
JsonNamingPolicy.CamelCase to the http JSON options — single-word
enum members serialize to the same lowercase strings as before.

DTO renamed: Common.DTO.RegionStatus -> RegionStatusResponse to
free the RegionStatus name for the new enum (forced by the task's
explicit enum name); the renamed DTO has no public-API impact at
the JSON wire level. Stale doc references updated.

AC RT2 in _docs/00_problem/acceptance_criteria.md now lists all 4
point types (start/end/action/intermediate).

Tests: 171 / 171 unit + 5 / 5 smoke green (was 141 + 5; +30 new tests
covering type handler round-trip, set/parse, unknown-value rejection,
idempotent registration, and the AC RT2 doc check).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-11 03:55:22 +03:00

41 lines
1.2 KiB
C#

using FluentAssertions;
namespace SatelliteProvider.Tests;
public class AcceptanceCriteriaRT2Tests
{
[Fact]
public void RT2_LinesAllFourPointTypes_AZ370_AC3()
{
var path = LocateAcceptanceCriteriaMd();
if (path is null)
{
Assert.Fail("acceptance_criteria.md not found from test runtime — repo layout drift");
}
var content = File.ReadAllText(path);
var rt2Line = content.Split('\n').FirstOrDefault(line => line.Contains("| RT2 |"));
rt2Line.Should().NotBeNull("RT2 row must exist in the Route Management section");
rt2Line!.Should().Contain("\"start\"");
rt2Line.Should().Contain("\"end\"");
rt2Line.Should().Contain("\"action\"");
rt2Line.Should().Contain("\"intermediate\"");
}
private static string? LocateAcceptanceCriteriaMd()
{
var dir = new DirectoryInfo(Directory.GetCurrentDirectory());
while (dir is not null)
{
var candidate = Path.Combine(dir.FullName, "_docs", "00_problem", "acceptance_criteria.md");
if (File.Exists(candidate))
{
return candidate;
}
dir = dir.Parent;
}
return null;
}
}