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:
		@@ -1,46 +1,55 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.Immutable;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
 | 
			
		||||
namespace StellaOps.Concelier.Exporter.Json;
 | 
			
		||||
 | 
			
		||||
public sealed class JsonExportResult
 | 
			
		||||
{
 | 
			
		||||
    public JsonExportResult(
 | 
			
		||||
        string exportDirectory,
 | 
			
		||||
        DateTimeOffset exportedAt,
 | 
			
		||||
        IEnumerable<JsonExportFile> files,
 | 
			
		||||
        int advisoryCount,
 | 
			
		||||
        long totalBytes)
 | 
			
		||||
    {
 | 
			
		||||
        if (string.IsNullOrWhiteSpace(exportDirectory))
 | 
			
		||||
        {
 | 
			
		||||
            throw new ArgumentException("Export directory must be provided.", nameof(exportDirectory));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ExportDirectory = exportDirectory;
 | 
			
		||||
        ExportedAt = exportedAt;
 | 
			
		||||
        AdvisoryCount = advisoryCount;
 | 
			
		||||
        TotalBytes = totalBytes;
 | 
			
		||||
 | 
			
		||||
        var list = (files ?? throw new ArgumentNullException(nameof(files)))
 | 
			
		||||
            .Where(static file => file is not null)
 | 
			
		||||
            .ToImmutableArray();
 | 
			
		||||
 | 
			
		||||
        Files = list;
 | 
			
		||||
        FilePaths = list.Select(static file => file.RelativePath).ToImmutableArray();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string ExportDirectory { get; }
 | 
			
		||||
 | 
			
		||||
    public DateTimeOffset ExportedAt { get; }
 | 
			
		||||
 | 
			
		||||
    public ImmutableArray<JsonExportFile> Files { get; }
 | 
			
		||||
 | 
			
		||||
    public ImmutableArray<string> FilePaths { get; }
 | 
			
		||||
 | 
			
		||||
    public int AdvisoryCount { get; }
 | 
			
		||||
 | 
			
		||||
    public long TotalBytes { get; }
 | 
			
		||||
}
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Collections.Immutable;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using StellaOps.Concelier.Models;
 | 
			
		||||
 | 
			
		||||
namespace StellaOps.Concelier.Exporter.Json;
 | 
			
		||||
 | 
			
		||||
public sealed class JsonExportResult
 | 
			
		||||
{
 | 
			
		||||
    public JsonExportResult(
 | 
			
		||||
        string exportDirectory,
 | 
			
		||||
        DateTimeOffset exportedAt,
 | 
			
		||||
        IEnumerable<JsonExportFile> files,
 | 
			
		||||
        int advisoryCount,
 | 
			
		||||
        long totalBytes,
 | 
			
		||||
        IEnumerable<Advisory>? advisories = null)
 | 
			
		||||
    {
 | 
			
		||||
        if (string.IsNullOrWhiteSpace(exportDirectory))
 | 
			
		||||
        {
 | 
			
		||||
            throw new ArgumentException("Export directory must be provided.", nameof(exportDirectory));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        var list = (files ?? throw new ArgumentNullException(nameof(files)))
 | 
			
		||||
            .Where(static file => file is not null)
 | 
			
		||||
            .ToImmutableArray();
 | 
			
		||||
 | 
			
		||||
        var advisoryList = (advisories ?? Array.Empty<Advisory>())
 | 
			
		||||
            .Where(static advisory => advisory is not null)
 | 
			
		||||
            .ToImmutableArray();
 | 
			
		||||
 | 
			
		||||
        ExportDirectory = exportDirectory;
 | 
			
		||||
        ExportedAt = exportedAt;
 | 
			
		||||
        TotalBytes = totalBytes;
 | 
			
		||||
 | 
			
		||||
        Files = list;
 | 
			
		||||
        FilePaths = list.Select(static file => file.RelativePath).ToImmutableArray();
 | 
			
		||||
        Advisories = advisoryList;
 | 
			
		||||
        AdvisoryCount = advisoryList.IsDefaultOrEmpty ? advisoryCount : advisoryList.Length;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public string ExportDirectory { get; }
 | 
			
		||||
 | 
			
		||||
    public DateTimeOffset ExportedAt { get; }
 | 
			
		||||
 | 
			
		||||
    public ImmutableArray<JsonExportFile> Files { get; }
 | 
			
		||||
 | 
			
		||||
    public ImmutableArray<string> FilePaths { get; }
 | 
			
		||||
 | 
			
		||||
    public ImmutableArray<Advisory> Advisories { get; }
 | 
			
		||||
 | 
			
		||||
    public int AdvisoryCount { get; }
 | 
			
		||||
 | 
			
		||||
    public long TotalBytes { get; }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user