Refactor: Rename DocumentOperator to DocumentService

Updated project and solution files to rename and restructure
`DocumentOperator` to `DocumentService`. Modified project
references in `DocumentService.API.csproj`, `DocumentService.Application.csproj`,
and `DocumentService.Infrastructure.csproj` to reflect the new
naming convention. Updated `DocumentService.sln` to remove
old project references, add new ones, and adjust configuration
and nested project mappings accordingly. This change aligns
the project structure with the new naming convention.
This commit is contained in:
2026-08-30 21:33:25 +02:00
parent 050cb55bf9
commit 207c778f3a
108 changed files with 37 additions and 37 deletions

View File

@@ -0,0 +1,56 @@
using System.Net;
using System.Net.Http;
using System.Text;
using System.Text.Json;
namespace DocumentService.Tests.Unit.Client;
/// <summary>
/// Reusable fake <see cref="HttpMessageHandler"/> for unit-testing HTTP clients.
/// Captures the outgoing request and returns the configured response.
/// </summary>
internal sealed class MockHttpMessageHandler : HttpMessageHandler
{
private readonly HttpResponseMessage _response;
/// <summary>The last request that was sent through this handler.</summary>
public HttpRequestMessage? LastRequest { get; private set; }
public MockHttpMessageHandler(HttpResponseMessage response)
{
_response = response;
}
// ?? convenience factories ????????????????????????????????????????????????
/// <summary>Creates a handler that returns 200 OK with a JSON-serialised body.</summary>
public static MockHttpMessageHandler ReturningJson<T>(T body, HttpStatusCode status = HttpStatusCode.OK)
{
var json = JsonSerializer.Serialize(body, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
var response = new HttpResponseMessage(status)
{
Content = new StringContent(json, Encoding.UTF8, "application/json")
};
return new MockHttpMessageHandler(response);
}
/// <summary>Creates a handler that returns 200 OK with raw bytes as the body.</summary>
public static MockHttpMessageHandler ReturningBytes(byte[] bytes, string mediaType = "application/octet-stream", HttpStatusCode status = HttpStatusCode.OK)
{
var response = new HttpResponseMessage(status)
{
Content = new ByteArrayContent(bytes) { Headers = { ContentType = new(mediaType) } }
};
return new MockHttpMessageHandler(response);
}
/// <summary>Creates a handler that returns the given status code with no body.</summary>
public static MockHttpMessageHandler ReturningStatus(HttpStatusCode status)
=> new(new HttpResponseMessage(status));
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
LastRequest = request;
return Task.FromResult(_response);
}
}