LANCommander/LANCommander.Server.Tests/Client/AuthenticationTests.cs
Pat Hartl 8737060679 Merge branch 'main' into feature/game-versioning
# Conflicts:
#	LANCommander.Server.Tests/ApplicationFixture.cs
#	LANCommander.Server.Tests/BaseTest.cs
#	LANCommander.Server.Tests/Client/AuthenticationTests.cs
#	LANCommander.Server.Tests/Data/VersioningTests.cs
#	LANCommander.Server.Tests/Mocks/VersionProviderMock.cs
2026-06-30 17:58:16 -05:00

35 lines
No EOL
1.4 KiB
C#

using LANCommander.SDK.Extensions;
using Shouldly;
namespace LANCommander.Server.Tests.Client;
[Collection("Application")]
public class AuthenticationTests : IClassFixture<ApplicationFixture>
{
private readonly ApplicationFixture _fixture;
public AuthenticationTests(ApplicationFixture fixture)
{
_fixture = ApplicationFixture.Instance;
}
// Quarantined: depends on the removed monolithic SDK.Client facade (PingAsync).
// Needs rewiring to the per-domain DI clients introduced in commit 1936f505.
[Fact(Skip = "Pending migration to per-domain SDK clients (monolithic SDK.Client removed)")]
public async Task PingShouldWork()
{
// ConnectionClient.PingAsync uses a static HttpClient that does real network I/O and so
// cannot reach the in-memory test server. Exercise the server's PingMiddleware directly
// through the in-memory handler instead, asserting the same X-Ping/X-Pong contract.
var pingId = Guid.NewGuid().ToString();
var request = new HttpRequestMessage(HttpMethod.Head, _fixture.ServerAddress);
request.Headers.Add("X-Ping", pingId);
var response = await _fixture.HttpClient.SendAsync(request);
response.IsSuccessStatusCode.ShouldBeTrue();
response.Headers.Contains("X-Pong").ShouldBeTrue();
response.Headers.GetValues("X-Pong").First().ShouldBe(pingId.FastReverse());
}
}