refactor: extract remaining Telegram handlers to platform-neutral contracts
PR Checks / test-and-build (pull_request) Successful in 13m48s
PR Checks / test-and-build (pull_request) Successful in 13m48s
- Extract CreateSessionHandler, ListSessionsHandler, DeleteSessionHandler, ExportCalendarHandler, HandleRescheduleTimeInputHandler, HandleRescheduleVoteHandler to GmRelay.Shared - Add IPlatformMessenger methods: SendScheduleAsync, UpdateScheduleAsync, SendGroupMessageAsync with actions, CreateThreadAsync, DeleteThreadAsync - Rewrite Telegram Bot wrappers as thin adapters delegating to shared handlers - Rewrite DiscordRescheduleVoteHandler to use shared HandleRescheduleVoteHandler - Update UpdateRouter with explicit type aliases for ambiguous handler names - Add contract and source-inspection tests for extracted handlers - Bump version 3.1.1 → 3.2.0 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
using GmRelay.Shared.Features.Sessions.ExportCalendar;
|
||||
using GmRelay.Shared.Platform;
|
||||
|
||||
namespace GmRelay.Bot.Tests.Features.Sessions.ExportCalendar;
|
||||
|
||||
public sealed class ExportCalendarCommandContractTests
|
||||
{
|
||||
[Fact]
|
||||
public void ExportCalendarCommand_ShouldExposePlatformNeutralContext()
|
||||
{
|
||||
AssertProperty<ExportCalendarCommand>("Group", typeof(PlatformGroup));
|
||||
AssertProperty<ExportCalendarCommand>("User", typeof(PlatformUser));
|
||||
AssertNoTelegramSpecificProperties<ExportCalendarCommand>();
|
||||
}
|
||||
|
||||
private static void AssertProperty<T>(string name, Type expectedType)
|
||||
{
|
||||
var property = Assert.Single(typeof(T).GetProperties(), p => p.Name == name);
|
||||
Assert.Equal(expectedType, property.PropertyType);
|
||||
}
|
||||
|
||||
private static void AssertNoTelegramSpecificProperties<T>()
|
||||
{
|
||||
var names = typeof(T).GetProperties().Select(p => p.Name).ToArray();
|
||||
Assert.DoesNotContain(names, name => name.Contains("Telegram", StringComparison.Ordinal));
|
||||
Assert.DoesNotContain("ChatId", names);
|
||||
Assert.DoesNotContain("MessageId", names);
|
||||
Assert.DoesNotContain("TelegramUserId", names);
|
||||
Assert.DoesNotContain("TelegramUsername", names);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user