Skip to content

Test HTTP command error responses through real endpoints #605

Description

@nmummau

Problem

The HTTP result-mapping code has approximately 24% line coverage in the October 5, 2026 .NET 10 coverage run. Most error-response paths are untested. These paths define the status codes and problem-details bodies that API clients rely on. You can view a test coverage report I generated here: index.html

Source: ResultExtensions.cs.

Proposed tests

Send HTTP requests to test endpoints backed by command services that produce each outcome:

Command outcome Expected response
Success HTTP 200 with the expected result body
Domain validation failure HTTP 400 with domain validation details
Missing aggregate HTTP 404 with problem details
Optimistic concurrency conflict HTTP 409 with problem details
Unexpected failure HTTP 500 with problem details

Cover both minimal-API and controller command mappings, since they use separate result-conversion paths. Assert the response content type and stable problem-details fields, including domain errors where applicable.

Acceptance criteria

  • Each outcome is exercised through an HTTP request to a hosted test application.
  • Both minimal-API and controller mappings are covered.
  • Assertions verify status codes and response bodies, rather than only whether requests complete.
  • Error responses use the expected problem-details content type and structure.
  • Tests avoid brittle comparisons of full exception stack traces.
  • No direct tests of ResultExtensions, external database, or Docker container are required.

Validation

Extend the existing ASP.NET Core test application and run the affected endpoint tests. Collect focused coverage for the HTTP result-mapping paths; do not rerun unrelated provider suites.

Activity

  1. linear commented on Oct 6, 2026

    @linear
  2. nmummau commented on Oct 6, 2026

    @nmummau
    ContributorAuthor

    I’ve implemented this locally with regression tests. I’m waiting for a prerequisite PR 603 to merge so I can rebase and open a focused PR. I’ll link it here once it’s ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions