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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user