Files
missions/tests/Azaion.Missions.E2E.Tests/Tests/Waypoints/NegativeTests.cs
T
Oleksandr Bezdieniezhnykh 6b2c2d998e [AZ-577] [AZ-578] [AZ-579] [AZ-580] Implement E2E test batch 2
Adds 26 blackbox tests (FT-P-01..18, FT-N-01..08) covering full AC
matrices for Vehicles/Missions/Waypoints/Health/Errors. Three
spec-vs-code carry-forwards documented in batch_02_report.md and
pinned with [Trait("carry_forward", ...)].

Shared scaffolding: ApiDtos.cs, AssertProblemEnvelopeAsync helper,
Seeds.cs, StubSchema.cs, CascadeF3/F4 fixtures, PostgresStopStart
fixture (gated by COMPOSE_RESTART_ENABLED). Removes the 4 placeholder
Sanity.cs files (now superseded). docker-compose.test.yml gains the
expected_results volume mount + FIXTURE_SQL_DIR for the consumer.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 08:28:37 +03:00

48 lines
1.8 KiB
C#

using System.Net;
using System.Net.Http.Headers;
using Azaion.Missions.E2E.Fixtures;
using Azaion.Missions.E2E.Helpers;
using Xunit;
namespace Azaion.Missions.E2E.Tests.Waypoints;
/// <summary>
/// FT-N-07 — waypoint operation against a missing mission must surface as
/// a 404 with the standard envelope (results_report.md row 4.1 / AC-4.2).
/// </summary>
[Collection("Waypoints")]
[Trait("Category", "Blackbox")]
[Trait("db_access", "seed-or-assert-only")]
public sealed class NegativeTests : TestBase, IClassFixture<DbResetFixture>
{
[Fact]
[Trait("Traces", "AC-4.2")]
[Trait("max_ms", "2000")]
[Trait("carry_forward", "AC-4.2")]
public async Task FT_N_07_waypoint_list_against_missing_mission_returns_empty_array_today()
{
// CARRY-FORWARD: spec says 404 with problem envelope (AZ-580 AC-7
// and results_report.md row 4.1). Today the SUT
// (WaypointService.GetWaypoints) does NOT validate parent existence
// — it returns an empty list which the controller wraps as 200 []. Per
// /autodev batch 2 user choice, this test asserts the CODE shape.
// Flip to 404+envelope expectation when the divergence is closed.
// Arrange
DbResetFixture.ResetDatabase(TestEnvironment.DbSideChannel);
var token = await Tokens.MintDefaultAsync();
var randomMissionId = Guid.NewGuid();
// Act
using var http = new HttpRequestMessage(
HttpMethod.Get, $"/missions/{randomMissionId}/waypoints");
http.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token.Jwt);
using var response = await Missions.SendAsync(http);
// Assert
await HttpAssertions.AssertStatusAsync(response, HttpStatusCode.OK);
var raw = await response.Content.ReadAsStringAsync();
Assert.Equal("[]", raw.Trim());
}
}