542f15f2d6
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>
42 lines
1.7 KiB
C#
42 lines
1.7 KiB
C#
using GmRelay.Shared.Features.Sessions.ListSessions;
|
|
using GmRelay.Shared.Platform;
|
|
|
|
namespace GmRelay.Bot.Tests.Features.Sessions.ListSessions;
|
|
|
|
public sealed class ListSessionsCommandContractTests
|
|
{
|
|
[Fact]
|
|
public void ListSessionsCommand_ShouldExposePlatformNeutralContext()
|
|
{
|
|
AssertProperty<ListSessionsCommand>("Group", typeof(PlatformGroup));
|
|
AssertProperty<ListSessionsCommand>("User", typeof(PlatformUser));
|
|
AssertNoTelegramSpecificProperties<ListSessionsCommand>();
|
|
}
|
|
|
|
[Fact]
|
|
public void DeleteSessionCommand_ShouldExposePlatformNeutralContext()
|
|
{
|
|
AssertProperty<DeleteSessionCommand>("SessionId", typeof(Guid));
|
|
AssertProperty<DeleteSessionCommand>("User", typeof(PlatformUser));
|
|
AssertProperty<DeleteSessionCommand>("Group", typeof(PlatformGroup));
|
|
AssertProperty<DeleteSessionCommand>("ScheduleMessage", typeof(PlatformMessageRef));
|
|
AssertNoTelegramSpecificProperties<DeleteSessionCommand>();
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|