05ca8061e9
PR Checks / test-and-build (pull_request) Successful in 5m46s
Add a separate GmRelay.DiscordBot worker using NetCord Gateway with startup token validation, PostgreSQL datasource registration, slash-command setup, component interaction service registration, and lifecycle logging. Wire the Discord service through Aspire AppHost, Docker Compose, PR checks, deploy image build/push/scan/pull steps, README docs, and synchronized version 2.2.0. Add TDD coverage for project isolation, token validation, startup wiring, runtime wiring, and version synchronization. Bump version -> 2.2.0
29 lines
729 B
C#
29 lines
729 B
C#
using GmRelay.DiscordBot;
|
|
|
|
namespace GmRelay.Bot.Tests.Discord;
|
|
|
|
public sealed class DiscordOptionsTests
|
|
{
|
|
[Theory]
|
|
[InlineData(null)]
|
|
[InlineData("")]
|
|
[InlineData(" ")]
|
|
public void Validate_ShouldRejectMissingToken(string? token)
|
|
{
|
|
var options = new DiscordOptions { Token = token };
|
|
|
|
var exception = Assert.Throws<InvalidOperationException>(options.Validate);
|
|
|
|
Assert.Contains("Discord:Token is required", exception.Message);
|
|
Assert.Contains("Discord__Token", exception.Message);
|
|
}
|
|
|
|
[Fact]
|
|
public void Validate_ShouldAcceptConfiguredToken()
|
|
{
|
|
var options = new DiscordOptions { Token = "configured-token" };
|
|
|
|
options.Validate();
|
|
}
|
|
}
|