diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/HealthChecks/ApiReachabilityHealthCheckTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/HealthChecks/ApiReachabilityHealthCheckTests.cs
new file mode 100644
index 00000000..d4998a32
--- /dev/null
+++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/HealthChecks/ApiReachabilityHealthCheckTests.cs
@@ -0,0 +1,116 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.DTO.Configuration;
+using Lumina.Presentation.Web.Common.HealthChecks;
+using Lumina.Presentation.Web.Fixtures.Common.Api;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.Configuration;
+using Microsoft.Extensions.Diagnostics.HealthChecks;
+using Microsoft.Extensions.Options;
+using NSubstitute;
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Net;
+using System.Net.Http;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.UnitTests.Common.HealthChecks;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class ApiReachabilityHealthCheckTests
+{
+ private readonly ServerConfigurationDtoFixture _serverConfigurationDtoFixture = new();
+
+ [Fact]
+ public async Task CheckHealthAsync_WhenApiReturnsSuccess_ShouldReturnHealthyAndProbeReadyEndpoint()
+ {
+ // Arrange
+ TestApiHttpMessageHandler messageHandler = new(_ => new HttpResponseMessage(HttpStatusCode.OK));
+ ApiReachabilityHealthCheck sut = CreateSut(messageHandler);
+
+ // Act
+ HealthCheckResult result = await sut.CheckHealthAsync(CreateHealthCheckContext(sut), CancellationToken.None);
+
+ // Assert
+ Assert.Equal(HealthStatus.Healthy, result.Status);
+ Assert.Single(messageHandler.Requests);
+ Assert.Equal("http://localhost:5214/health/ready", messageHandler.Requests[0].RequestUri!.ToString());
+ }
+
+ [Fact]
+ public async Task CheckHealthAsync_WhenApiReturnsErrorStatus_ShouldReturnUnhealthyWithStatusCodeDescription()
+ {
+ // Arrange
+ TestApiHttpMessageHandler messageHandler = new(_ => new HttpResponseMessage(HttpStatusCode.ServiceUnavailable));
+ ApiReachabilityHealthCheck sut = CreateSut(messageHandler);
+
+ // Act
+ HealthCheckResult result = await sut.CheckHealthAsync(CreateHealthCheckContext(sut), CancellationToken.None);
+
+ // Assert
+ Assert.Equal(HealthStatus.Unhealthy, result.Status);
+ Assert.Equal("The API returned status 503.", result.Description);
+ }
+
+ [Fact]
+ public async Task CheckHealthAsync_WhenApiRequestThrowsException_ShouldReturnUnhealthyWithException()
+ {
+ // Arrange
+ TestApiHttpMessageHandler messageHandler = new(_ => throw new HttpRequestException("The API is down."));
+ ApiReachabilityHealthCheck sut = CreateSut(messageHandler);
+
+ // Act
+ HealthCheckResult result = await sut.CheckHealthAsync(CreateHealthCheckContext(sut), CancellationToken.None);
+
+ // Assert
+ Assert.Equal(HealthStatus.Unhealthy, result.Status);
+ Assert.Equal("The API is not reachable.", result.Description);
+ Assert.NotNull(result.Exception);
+ }
+
+ [Fact]
+ public async Task CheckHealthAsync_WhenCancellationIsRequestedBeforeProbe_ShouldReturnUnhealthy()
+ {
+ // Arrange
+ TestApiHttpMessageHandler messageHandler = new(_ => new HttpResponseMessage(HttpStatusCode.OK));
+ ApiReachabilityHealthCheck sut = CreateSut(messageHandler);
+ CancellationTokenSource cancellationTokenSource = new();
+ cancellationTokenSource.Cancel();
+
+ // Act
+ HealthCheckResult result = await sut.CheckHealthAsync(CreateHealthCheckContext(sut), cancellationTokenSource.Token);
+
+ // Assert
+ Assert.Equal(HealthStatus.Unhealthy, result.Status);
+ Assert.Equal("The API is not reachable.", result.Description);
+ }
+
+ ///
+ /// Creates a whose registration points at the given health check.
+ ///
+ /// The health check to register in the context.
+ /// The created instance.
+ private static HealthCheckContext CreateHealthCheckContext(IHealthCheck healthCheck)
+ {
+ // the ApiReachabilityHealthCheck never reads the registration, so a bare context is sufficient
+ return new HealthCheckContext();
+ }
+
+ ///
+ /// Creates the system under test configured with the provided message handler and a fixed server configuration.
+ ///
+ /// The message handler backing the inner .
+ /// The created .
+ private ApiReachabilityHealthCheck CreateSut(TestApiHttpMessageHandler messageHandler)
+ {
+ HttpClient httpClient = new(messageHandler);
+ IHttpClientFactory httpClientFactory = Substitute.For();
+ httpClientFactory.CreateClient().Returns(httpClient);
+ IOptionsSnapshot serverConfigurationOptions = Substitute.For>();
+ serverConfigurationOptions.Value.Returns(_serverConfigurationDtoFixture.Create(apiVersion: '1', baseAddress: "http://localhost", port: 5214));
+ return new ApiReachabilityHealthCheck(httpClientFactory, serverConfigurationOptions);
+ }
+}
diff --git a/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Middlewares/ExceptionHandlingMiddlewareTests.cs b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Middlewares/ExceptionHandlingMiddlewareTests.cs
new file mode 100644
index 00000000..cd7baeb9
--- /dev/null
+++ b/tests/UnitTests/Lumina.Presentation.Web.UnitTests/Common/Middlewares/ExceptionHandlingMiddlewareTests.cs
@@ -0,0 +1,397 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Presentation.Web.Common.DTO.Common;
+using Lumina.Presentation.Web.Common.Exceptions;
+using Lumina.Presentation.Web.Common.Middlewares;
+using Lumina.Presentation.Web.Fixtures.Common.DTO.Common;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Authentication.Cookies;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Localization;
+using Microsoft.Extensions.Logging;
+using NSubstitute;
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.IO;
+using System.Net;
+using System.Security.Claims;
+using System.Text;
+using System.Text.Json;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Presentation.Web.UnitTests.Common.Middlewares;
+
+///
+/// Contains unit tests for the class.
+///
+[ExcludeFromCodeCoverage]
+public class ExceptionHandlingMiddlewareTests
+{
+ private readonly ILogger _mockLogger;
+ private readonly IStringLocalizer _mockStringLocalizer;
+ private readonly IAuthenticationService _mockAuthenticationService;
+ private readonly ExceptionHandlingMiddleware _sut;
+ private readonly ProblemDetailsDtoFixture _problemDetailsDtoFixture = new();
+ private RequestDelegate _nextDelegate;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ExceptionHandlingMiddlewareTests()
+ {
+ _mockLogger = Substitute.For>();
+ _mockStringLocalizer = Substitute.For>();
+ _mockStringLocalizer[Arg.Any()].Returns(callInfo => new LocalizedString(callInfo.Arg(), $"localized:{callInfo.Arg()}"));
+ _mockAuthenticationService = Substitute.For();
+ _mockAuthenticationService.SignOutAsync(Arg.Any(), Arg.Any(), Arg.Any()).Returns(Task.CompletedTask);
+ _mockAuthenticationService.ForbidAsync(Arg.Any(), Arg.Any(), Arg.Any()).Returns(Task.CompletedTask);
+ _nextDelegate = context => Task.CompletedTask;
+ _sut = new ExceptionHandlingMiddleware(context => _nextDelegate(context), _mockLogger, _mockStringLocalizer);
+ }
+
+ [Fact]
+ public async Task InvokeAsync_WhenNextCompletesSuccessfully_ShouldNotModifyResponse()
+ {
+ // Arrange
+ DefaultHttpContext httpContext = CreateHttpContext();
+ _nextDelegate = context => Task.CompletedTask;
+
+ // Act
+ await _sut.InvokeAsync(httpContext);
+
+ // Assert
+ Assert.Equal(StatusCodes.Status200OK, httpContext.Response.StatusCode);
+ Assert.Equal(0, httpContext.Response.Body.Length);
+ }
+
+ [Fact]
+ public async Task InvokeAsync_WhenNextThrowsNonApiException_ShouldLogErrorAndWriteFailureJson()
+ {
+ // Arrange
+ DefaultHttpContext httpContext = CreateHttpContext();
+ _nextDelegate = _ => throw new InvalidOperationException("Unexpected failure");
+
+ // Act
+ await _sut.InvokeAsync(httpContext);
+
+ // Assert
+ Assert.Contains("application/json", httpContext.Response.ContentType);
+ string body = await ReadResponseBodyAsync(httpContext);
+ using JsonDocument jsonDocument = JsonDocument.Parse(body);
+ Assert.False(jsonDocument.RootElement.GetProperty("success").GetBoolean());
+ Assert.Equal("Unexpected failure", jsonDocument.RootElement.GetProperty("errorMessage").GetString());
+ _mockLogger.Received(1).Log(
+ LogLevel.Error,
+ Arg.Any(),
+ Arg.Any