Stryker.NET config for the domain service (break 90, the repo's ratchet floor), excluding the OpenZaakJobPump hosted-shell from mutation. Hardened the unit tests to kill survivors — Basic-credential value, variable types, null/failure response paths, option defaults, guard clauses, save counts and log output — leaving only two documented equivalent mutants (Stryker-disabled). make mutation runs the domain ratchet and CI uploads its report alongside the others. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using System.Net;
|
|
using Big.Infrastructure;
|
|
|
|
namespace Big.Tests;
|
|
|
|
public class AclHttpClientTests
|
|
{
|
|
private static AclHttpClient Client(StubHandler handler) => new(
|
|
new HttpClient(handler), new AclOptions { BaseUrl = new("http://acl/") });
|
|
|
|
[Fact]
|
|
public async Task Opens_a_zaak_by_posting_the_bsn_and_returns_the_zaak_url()
|
|
{
|
|
var capture = new RequestCapture();
|
|
var client = Client(capture.Responds(HttpStatusCode.OK,
|
|
"""{"zaakUrl":"http://openzaak/zaken/api/v1/zaken/abc"}"""));
|
|
|
|
var url = await client.OpenZaakAsync("123456782");
|
|
|
|
Assert.Equal("http://openzaak/zaken/api/v1/zaken/abc", url.ToString());
|
|
Assert.Equal(HttpMethod.Post, capture.Seen!.Method);
|
|
Assert.Equal("http://acl/zaken", capture.Seen.RequestUri!.ToString());
|
|
Assert.Contains("\"bsn\":\"123456782\"", capture.Body);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Throws_when_the_acl_rejects_the_request()
|
|
{
|
|
var capture = new RequestCapture();
|
|
var client = Client(capture.Responds(HttpStatusCode.BadGateway));
|
|
|
|
await Assert.ThrowsAsync<HttpRequestException>(() => client.OpenZaakAsync("123456782"));
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Throws_when_the_acl_returns_an_empty_body()
|
|
{
|
|
var capture = new RequestCapture();
|
|
var client = Client(capture.Responds(HttpStatusCode.OK, "null"));
|
|
|
|
var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => client.OpenZaakAsync("123456782"));
|
|
Assert.Contains("empty", ex.Message, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
}
|