Add channel test providers for Email, Slack, Teams, and Webhook

- Implemented EmailChannelTestProvider to generate email preview payloads.
- Implemented SlackChannelTestProvider to create Slack message previews.
- Implemented TeamsChannelTestProvider for generating Teams Adaptive Card previews.
- Implemented WebhookChannelTestProvider to create webhook payloads.
- Added INotifyChannelTestProvider interface for channel-specific preview generation.
- Created ChannelTestPreviewContracts for request and response models.
- Developed NotifyChannelTestService to handle test send requests and generate previews.
- Added rate limit policies for test sends and delivery history.
- Implemented unit tests for service registration and binding.
- Updated project files to include necessary dependencies and configurations.
This commit is contained in:
master
2025-10-19 23:29:34 +03:00
parent a811f7ac47
commit a07f46231b
239 changed files with 17245 additions and 3155 deletions

View File

@@ -0,0 +1,64 @@
using System;
using Microsoft.Extensions.DependencyInjection;
namespace StellaOps.DependencyInjection;
/// <summary>
/// Declares how a plug-in type should be registered with the host dependency injection container.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public sealed class ServiceBindingAttribute : Attribute
{
/// <summary>
/// Creates a binding that registers the decorated type as itself with a singleton lifetime.
/// </summary>
public ServiceBindingAttribute()
: this(null, ServiceLifetime.Singleton)
{
}
/// <summary>
/// Creates a binding that registers the decorated type as itself with the specified lifetime.
/// </summary>
public ServiceBindingAttribute(ServiceLifetime lifetime)
: this(null, lifetime)
{
}
/// <summary>
/// Creates a binding that registers the decorated type as the specified service type with a singleton lifetime.
/// </summary>
public ServiceBindingAttribute(Type serviceType)
: this(serviceType, ServiceLifetime.Singleton)
{
}
/// <summary>
/// Creates a binding that registers the decorated type as the specified service type.
/// </summary>
public ServiceBindingAttribute(Type? serviceType, ServiceLifetime lifetime)
{
ServiceType = serviceType;
Lifetime = lifetime;
}
/// <summary>
/// The service contract that should resolve to the decorated implementation. When <c>null</c>, the implementation registers itself.
/// </summary>
public Type? ServiceType { get; }
/// <summary>
/// The lifetime that should be used when registering the decorated implementation.
/// </summary>
public ServiceLifetime Lifetime { get; }
/// <summary>
/// Indicates whether existing descriptors for the same service type should be removed before this binding is applied.
/// </summary>
public bool ReplaceExisting { get; init; }
/// <summary>
/// When true, the implementation is also registered as itself even if a service type is specified.
/// </summary>
public bool RegisterAsSelf { get; init; }
}