Files
Anubis/tests/Anubis.Tests/HealthEndpointTests.cs
T
Alby96andClaude Opus 5.5 b4bf864f74
ci / test (postgres) (push) Successful in 1m18s
ci / test (sqlite) (push) Successful in 1m23s
ci / image (push) Successful in 41s
Set up phase 0: .NET 10 solution, toolchain, minimal app, Docker and CI
Empty but complete solution so every later phase starts from a working
toolchain: analyzers as errors, locked restore, format check, policy tests
that keep packages within ADR 0004 and keep live trading switched off,
a /health endpoint served from Docker, and a Gitea workflow with only
run steps. API facts of SPEC section 4 re-checked in docs/API-NOTES.md;
ADR 0006 records what changed (MSTest base packages, Ubuntu images,
OKX WebSocket on 443, Alpaca margin-only accounts).

refs #1 refs #2 refs #3 refs #4 refs #5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 09:51:41 +01:00

38 lines
1.3 KiB
C#

using System.Net;
using System.Net.Http.Json;
using Anubis.Server;
namespace Anubis.Tests;
[TestClass]
public sealed class HealthEndpointTests
{
[TestMethod]
[TestCategory(Category.Integration)]
public async Task HealthAnswersOkWithNameAndVersion()
{
// The real server on a free local port: no test host package needed (ADR 0004).
var app = ServerApp.Build(["--urls", "http://127.0.0.1:0"]);
await app.StartAsync().ConfigureAwait(false);
try
{
var address = app.Urls.Single();
using var http = new HttpClient { BaseAddress = new Uri(address) };
using var response = await http.GetAsync(new Uri("/health", UriKind.Relative)).ConfigureAwait(false);
var body = await response.Content.ReadFromJsonAsync<HealthResponse>().ConfigureAwait(false);
Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
Assert.IsNotNull(body);
Assert.AreEqual("ok", body.Status);
Assert.AreEqual(AnubisInfo.Name, body.Name);
Assert.AreEqual(AnubisInfo.Version, body.Version);
}
finally
{
await app.StopAsync().ConfigureAwait(false);
await app.DisposeAsync().ConfigureAwait(false);
}
}
}