Telemetry API
 
Loading...
Searching...
No Matches
TelemetryApi.Tests.ApiIntegrationTests Class Reference

Integration tests for the Telemetry API endpoints. These tests verify the full HTTP pipeline, including middleware, routing, and authorization logic defined in Program.cs. More...

Inheritance diagram for TelemetryApi.Tests.ApiIntegrationTests:

Public Member Functions

 ApiIntegrationTests (WebApplicationFactory< Program > factory)
 Initializes the integration test factory.
 
async Task Root_RedirectsToStatus ()
 Verifies that the root URL ("/") correctly redirects to the "/status" endpoint. Covers the redirect branch and location header validation.
 
async Task StatusEndpoint_ReturnsSuccessAndCorrectJson ()
 Verifies that the /status endpoint returns a successful response and the expected JSON structure.
 
async Task StatsEndpoint_ReturnsNotFound_WhenNoIpAvailable ()
 Verifies that if no IP header is present and the connection IP is null (which happens inherently in TestServer), the API correctly rejects the request.
 
async Task StatsEndpoint_ReturnsNotFound_WhenIpIsNotAllowed ()
 Verifies that /stats/ips returns 404 when the IP is not in the allowed list. Also covers the case where clientIp might be null or empty.
 
async Task StatsEndpoint_HandlesComplexAllowedIpString ()
 Verifies that the configuration parser handles multiple IPs, extra whitespaces, and empty entries correctly.
 
async Task StatsEndpoint_IncrementsRequestCounts ()
 Verifies that request counts are correctly incremented across multiple calls.
 

Detailed Description

Integration tests for the Telemetry API endpoints. These tests verify the full HTTP pipeline, including middleware, routing, and authorization logic defined in Program.cs.

Constructor & Destructor Documentation

◆ ApiIntegrationTests()

TelemetryApi.Tests.ApiIntegrationTests.ApiIntegrationTests ( WebApplicationFactory< Program > factory)
inline

Initializes the integration test factory.

Parameters
factoryThe WebApplicationFactory provided by xUnit.

The documentation for this class was generated from the following file: