Add Canonical JSON serialization library with tests and documentation

- Implemented CanonJson class for deterministic JSON serialization and hashing.
- Added unit tests for CanonJson functionality, covering various scenarios including key sorting, handling of nested objects, arrays, and special characters.
- Created project files for the Canonical JSON library and its tests, including necessary package references.
- Added README.md for library usage and API reference.
- Introduced RabbitMqIntegrationFactAttribute for conditional RabbitMQ integration tests.
This commit is contained in:
master
2025-12-19 15:35:00 +02:00
parent 43882078a4
commit 951a38d561
192 changed files with 27550 additions and 2611 deletions

View File

@@ -22,6 +22,9 @@ builder.Services.AddInMemoryTransport();
// Authority integration (no-op for demo)
builder.Services.AddNoOpAuthorityIntegration();
// Required for app.UseAuthentication() even when running without a real auth scheme (demo/tests).
builder.Services.AddAuthentication();
var app = builder.Build();
// Middleware pipeline

View File

@@ -3,6 +3,7 @@ using Examples.Inventory.Microservice.Endpoints;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Hosting;
using StellaOps.Microservice;
using StellaOps.Router.Common.Enums;
@@ -17,6 +18,7 @@ namespace Examples.Integration.Tests;
/// </summary>
public sealed class GatewayFixture : IAsyncLifetime
{
private readonly InMemoryConnectionRegistry _registry = new();
private WebApplicationFactory<Examples.Gateway.Program>? _gatewayFactory;
private IHost? _billingHost;
private IHost? _inventoryHost;
@@ -32,7 +34,8 @@ public sealed class GatewayFixture : IAsyncLifetime
builder.UseEnvironment("Testing");
builder.ConfigureServices(services =>
{
services.AddInMemoryTransport();
services.RemoveAll<InMemoryConnectionRegistry>();
services.AddSingleton(_registry);
});
});
@@ -59,7 +62,8 @@ public sealed class GatewayFixture : IAsyncLifetime
billingBuilder.Services.AddScoped<CreateInvoiceEndpoint>();
billingBuilder.Services.AddScoped<GetInvoiceEndpoint>();
billingBuilder.Services.AddScoped<UploadAttachmentEndpoint>();
billingBuilder.Services.AddInMemoryTransport();
billingBuilder.Services.AddSingleton(_registry);
billingBuilder.Services.AddInMemoryTransportClient();
_billingHost = billingBuilder.Build();
await _billingHost.StartAsync();
@@ -84,7 +88,8 @@ public sealed class GatewayFixture : IAsyncLifetime
});
inventoryBuilder.Services.AddScoped<ListItemsEndpoint>();
inventoryBuilder.Services.AddScoped<GetItemEndpoint>();
inventoryBuilder.Services.AddInMemoryTransport();
inventoryBuilder.Services.AddSingleton(_registry);
inventoryBuilder.Services.AddInMemoryTransportClient();
_inventoryHost = inventoryBuilder.Build();
await _inventoryHost.StartAsync();