Add unit tests for Router configuration and transport layers
- Implemented tests for RouterConfig, RoutingOptions, StaticInstanceConfig, and RouterConfigOptions to ensure default values are set correctly. - Added tests for RouterConfigProvider to validate configurations and ensure defaults are returned when no file is specified. - Created tests for ConfigValidationResult to check success and error scenarios. - Developed tests for ServiceCollectionExtensions to verify service registration for RouterConfig. - Introduced UdpTransportTests to validate serialization, connection, request-response, and error handling in UDP transport. - Added scripts for signing authority gaps and hashing DevPortal SDK snippets.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace StellaOps.Microservice.SourceGen;
|
||||
|
||||
/// <summary>
|
||||
/// Diagnostic descriptors for the source generator.
|
||||
/// </summary>
|
||||
internal static class DiagnosticDescriptors
|
||||
{
|
||||
private const string Category = "StellaOps.Microservice";
|
||||
|
||||
/// <summary>
|
||||
/// Class with [StellaEndpoint] must implement IStellaEndpoint or IRawStellaEndpoint.
|
||||
/// </summary>
|
||||
public static readonly DiagnosticDescriptor MissingHandlerInterface = new(
|
||||
id: "STELLA001",
|
||||
title: "Missing handler interface",
|
||||
messageFormat: "Class '{0}' with [StellaEndpoint] must implement IStellaEndpoint<TRequest, TResponse> or IRawStellaEndpoint",
|
||||
category: Category,
|
||||
defaultSeverity: DiagnosticSeverity.Error,
|
||||
isEnabledByDefault: true);
|
||||
|
||||
/// <summary>
|
||||
/// Duplicate endpoint detected.
|
||||
/// </summary>
|
||||
public static readonly DiagnosticDescriptor DuplicateEndpoint = new(
|
||||
id: "STELLA002",
|
||||
title: "Duplicate endpoint",
|
||||
messageFormat: "Duplicate endpoint: {0} {1} is defined in both '{2}' and '{3}'",
|
||||
category: Category,
|
||||
defaultSeverity: DiagnosticSeverity.Warning,
|
||||
isEnabledByDefault: true);
|
||||
|
||||
/// <summary>
|
||||
/// [StellaEndpoint] on abstract class is ignored.
|
||||
/// </summary>
|
||||
public static readonly DiagnosticDescriptor AbstractClassIgnored = new(
|
||||
id: "STELLA003",
|
||||
title: "Abstract class ignored",
|
||||
messageFormat: "[StellaEndpoint] on abstract class '{0}' is ignored",
|
||||
category: Category,
|
||||
defaultSeverity: DiagnosticSeverity.Warning,
|
||||
isEnabledByDefault: true);
|
||||
|
||||
/// <summary>
|
||||
/// Informational: endpoints generated.
|
||||
/// </summary>
|
||||
public static readonly DiagnosticDescriptor EndpointsGenerated = new(
|
||||
id: "STELLA004",
|
||||
title: "Endpoints generated",
|
||||
messageFormat: "Generated {0} endpoint descriptors",
|
||||
category: Category,
|
||||
defaultSeverity: DiagnosticSeverity.Info,
|
||||
isEnabledByDefault: false);
|
||||
}
|
||||
Reference in New Issue
Block a user