merge(blueprint-platform): integrate runtime wiring baseline
This commit is contained in:
commit
d341a6132f
@ -1,6 +0,0 @@
|
|||||||
namespace Core.Blueprint.Common;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -4,4 +4,8 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="10.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
using Core.Blueprint.Common.Runtime;
|
||||||
|
using Core.Blueprint.Common.Runtime.Health;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Common.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers baseline runtime services for blueprint platform consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintRuntimeServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds blueprint runtime core services and health checks.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintRuntimeCore(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.TryAddSingleton<IBlueprintSystemClock, BlueprintSystemClock>();
|
||||||
|
services.TryAddEnumerable(
|
||||||
|
ServiceDescriptor.Singleton<IHealthCheck, BlueprintRuntimeHealthCheck>());
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/Core.Blueprint.Common/Runtime/BlueprintCorrelationId.cs
Normal file
24
src/Core.Blueprint.Common/Runtime/BlueprintCorrelationId.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
namespace Core.Blueprint.Common.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a correlation identifier used for cross-layer request tracing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Value">Correlation identifier value.</param>
|
||||||
|
public readonly record struct BlueprintCorrelationId(string Value)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a correlation identifier from incoming value or runtime clock fallback.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="incomingValue">Incoming correlation identifier.</param>
|
||||||
|
/// <param name="clock">Runtime system clock for fallback generation.</param>
|
||||||
|
/// <returns>Normalized correlation identifier.</returns>
|
||||||
|
public static BlueprintCorrelationId Create(string? incomingValue, IBlueprintSystemClock clock)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(incomingValue))
|
||||||
|
{
|
||||||
|
return new BlueprintCorrelationId(incomingValue.Trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BlueprintCorrelationId($"corr-{clock.UtcNow:yyyyMMddHHmmssfff}");
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/Core.Blueprint.Common/Runtime/BlueprintSystemClock.cs
Normal file
10
src/Core.Blueprint.Common/Runtime/BlueprintSystemClock.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Core.Blueprint.Common.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default runtime system clock implementation.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class BlueprintSystemClock : IBlueprintSystemClock
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public DateTimeOffset UtcNow => DateTimeOffset.UtcNow;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Common.Runtime.Health;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Health check for baseline blueprint runtime dependencies.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class BlueprintRuntimeHealthCheck(IBlueprintSystemClock clock) : IHealthCheck
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Executes runtime health probe.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">Health check context.</param>
|
||||||
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
|
/// <returns>Healthy runtime status result.</returns>
|
||||||
|
public Task<HealthCheckResult> CheckHealthAsync(
|
||||||
|
HealthCheckContext context,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
var data = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
["checkedAtUtc"] = clock.UtcNow,
|
||||||
|
["component"] = context.Registration.Name
|
||||||
|
};
|
||||||
|
|
||||||
|
return Task.FromResult(HealthCheckResult.Healthy("Blueprint runtime registered.", data));
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/Core.Blueprint.Common/Runtime/IBlueprintSystemClock.cs
Normal file
12
src/Core.Blueprint.Common/Runtime/IBlueprintSystemClock.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace Core.Blueprint.Common.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides transport-neutral UTC time for runtime components.
|
||||||
|
/// </summary>
|
||||||
|
public interface IBlueprintSystemClock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets current UTC timestamp.
|
||||||
|
/// </summary>
|
||||||
|
DateTimeOffset UtcNow { get; }
|
||||||
|
}
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.KeyVault;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.KeyVault.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.KeyVault.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime key vault integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintKeyVaultServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds key vault runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="vaultName">Target key vault name.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintKeyVaultModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string vaultName = "default-vault")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintKeyVaultRuntimeSettings(ResolveVaultName(vaultName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveVaultName(string vaultName)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(vaultName))
|
||||||
|
{
|
||||||
|
return vaultName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "default-vault";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.KeyVault.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for key vault integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="VaultName">Target key vault name.</param>
|
||||||
|
public sealed record BlueprintKeyVaultRuntimeSettings(string VaultName);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.Logging;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.Logging.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Logging.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime logging defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintLoggingServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds blueprint logging runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="categoryPrefix">Logging category prefix.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintLoggingModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string categoryPrefix = "AgileWebs")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintLoggingRuntimeSettings(ResolveCategoryPrefix(categoryPrefix)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveCategoryPrefix(string categoryPrefix)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(categoryPrefix))
|
||||||
|
{
|
||||||
|
return categoryPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "AgileWebs";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.Logging.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for blueprint logging defaults.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="CategoryPrefix">Category prefix used by logging pipelines.</param>
|
||||||
|
public sealed record BlueprintLoggingRuntimeSettings(string CategoryPrefix);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.Mongo;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.Mongo.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Mongo.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime mongo integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintMongoServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds mongo runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="databaseName">Target mongo database name.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintMongoModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string databaseName = "agilewebs")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintMongoRuntimeSettings(ResolveDatabaseName(databaseName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveDatabaseName(string databaseName)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(databaseName))
|
||||||
|
{
|
||||||
|
return databaseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "agilewebs";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.Mongo.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for mongo integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="DatabaseName">Target mongo database name.</param>
|
||||||
|
public sealed record BlueprintMongoRuntimeSettings(string DatabaseName);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.Redis;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.Redis.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Redis.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime redis integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintRedisServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds redis runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="keyPrefix">Redis key prefix.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintRedisModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string keyPrefix = "agilewebs:")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintRedisRuntimeSettings(ResolveKeyPrefix(keyPrefix)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveKeyPrefix(string keyPrefix)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(keyPrefix))
|
||||||
|
{
|
||||||
|
return keyPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "agilewebs:";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.Redis.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for redis integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="KeyPrefix">Redis key prefix used by platform components.</param>
|
||||||
|
public sealed record BlueprintRedisRuntimeSettings(string KeyPrefix);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.SQLServer;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.SQLServer.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.SQLServer.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime sql server integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintSqlServerServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds sql server runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="connectionName">Logical connection name.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintSqlServerModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string connectionName = "DefaultConnection")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintSqlServerRuntimeSettings(ResolveConnectionName(connectionName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveConnectionName(string connectionName)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(connectionName))
|
||||||
|
{
|
||||||
|
return connectionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "DefaultConnection";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.SQLServer.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for sql server integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ConnectionName">Logical connection name used by consumers.</param>
|
||||||
|
public sealed record BlueprintSqlServerRuntimeSettings(string ConnectionName);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.Storage;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.Storage.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Storage.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime storage integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintStorageServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds storage runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="containerName">Logical storage container name.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintStorageModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string containerName = "default")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintStorageRuntimeSettings(ResolveContainerName(containerName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveContainerName(string containerName)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(containerName))
|
||||||
|
{
|
||||||
|
return containerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "default";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.Storage.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for storage integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ContainerName">Logical storage container name.</param>
|
||||||
|
public sealed record BlueprintStorageRuntimeSettings(string ContainerName);
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
using Core.Blueprint.Common.Runtime;
|
||||||
|
using Core.Blueprint.Common.Runtime.Health;
|
||||||
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Common.UnitTests;
|
||||||
|
|
||||||
|
public class BlueprintRuntimeTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Create_WhenIncomingValueProvided_ReturnsTrimmedCorrelationId()
|
||||||
|
{
|
||||||
|
var correlationId = BlueprintCorrelationId.Create(" corr-123 ", new FakeClock());
|
||||||
|
|
||||||
|
Assert.Equal("corr-123", correlationId.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Create_WhenIncomingValueMissing_UsesClockFallback()
|
||||||
|
{
|
||||||
|
var correlationId = BlueprintCorrelationId.Create(string.Empty, new FakeClock());
|
||||||
|
|
||||||
|
Assert.Equal("corr-20260222120000111", correlationId.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CheckHealthAsync_WhenInvoked_ReturnsHealthyStatus()
|
||||||
|
{
|
||||||
|
var clock = new FakeClock();
|
||||||
|
var healthCheck = new BlueprintRuntimeHealthCheck(clock);
|
||||||
|
var context = new HealthCheckContext
|
||||||
|
{
|
||||||
|
Registration = new HealthCheckRegistration(
|
||||||
|
"blueprint.runtime",
|
||||||
|
healthCheck,
|
||||||
|
failureStatus: null,
|
||||||
|
tags: [])
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = await healthCheck.CheckHealthAsync(context);
|
||||||
|
|
||||||
|
Assert.Equal(HealthStatus.Healthy, result.Status);
|
||||||
|
Assert.Equal(clock.UtcNow, result.Data["checkedAtUtc"]);
|
||||||
|
Assert.Equal("blueprint.runtime", result.Data["component"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class FakeClock : IBlueprintSystemClock
|
||||||
|
{
|
||||||
|
public DateTimeOffset UtcNow => new(2026, 2, 22, 12, 0, 0, 111, TimeSpan.Zero);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
namespace Core.Blueprint.Common.UnitTests;
|
|
||||||
|
|
||||||
public class UnitTest1
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void Test1()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.KeyVault.DependencyInjection;
|
||||||
|
using Core.Blueprint.KeyVault.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.KeyVault.UnitTests;
|
namespace Core.Blueprint.KeyVault.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintKeyVaultModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintKeyVaultModule("agile-vault");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintKeyVaultRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("agile-vault", settings.VaultName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.Logging.DependencyInjection;
|
||||||
|
using Core.Blueprint.Logging.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.Logging.UnitTests;
|
namespace Core.Blueprint.Logging.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintLoggingModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintLoggingModule("Core");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintLoggingRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("Core", settings.CategoryPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.Mongo.DependencyInjection;
|
||||||
|
using Core.Blueprint.Mongo.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.Mongo.UnitTests;
|
namespace Core.Blueprint.Mongo.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintMongoModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintMongoModule("catalog-db");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintMongoRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("catalog-db", settings.DatabaseName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.Redis.DependencyInjection;
|
||||||
|
using Core.Blueprint.Redis.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.Redis.UnitTests;
|
namespace Core.Blueprint.Redis.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintRedisModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintRedisModule("bb:");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintRedisRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("bb:", settings.KeyPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.SQLServer.DependencyInjection;
|
||||||
|
using Core.Blueprint.SQLServer.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.SQLServer.UnitTests;
|
namespace Core.Blueprint.SQLServer.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintSqlServerModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintSqlServerModule("Primary");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintSqlServerRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("Primary", settings.ConnectionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.Storage.DependencyInjection;
|
||||||
|
using Core.Blueprint.Storage.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.Storage.UnitTests;
|
namespace Core.Blueprint.Storage.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintStorageModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintStorageModule("media");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintStorageRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("media", settings.ContainerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user