Problem
DiscordChannelAdapter in BuildBot.Discord wraps Discord.Net's sealed concrete SocketTextChannel type. All its methods require a live Discord WebSocket connection and cannot be exercised in unit tests:
DiscordChannelAdapter(SocketTextChannel) constructor — requires a real SocketTextChannel
get_Name — calls _channel.Name on a live channel
EnterTypingState() — calls _channel.EnterTypingState() on a live channel
SendMessageAsync(Embed) — calls _channel.SendMessageAsync(...) on a live channel
Similarly, the success path of DiscordSocketClientAdapter.FindChannel (where a guild and text channel are found and a DiscordChannelAdapter is returned) is only reachable with a real Discord connection.
The infrastructure-dependent methods of DiscordSocketClientAdapter are also unreachable in unit tests:
LoginAsync / StartAsync / StopAsync / LogoutAsync / SetGameAsync — all call Discord API
What needs to happen
Create BuildBot.Discord.Integration.Tests (or extend an existing integration test project) to cover these paths against a real or stubbed Discord connection.
Related to #357.
Problem
DiscordChannelAdapterinBuildBot.Discordwraps Discord.Net's sealed concreteSocketTextChanneltype. All its methods require a live Discord WebSocket connection and cannot be exercised in unit tests:DiscordChannelAdapter(SocketTextChannel)constructor — requires a realSocketTextChannelget_Name— calls_channel.Nameon a live channelEnterTypingState()— calls_channel.EnterTypingState()on a live channelSendMessageAsync(Embed)— calls_channel.SendMessageAsync(...)on a live channelSimilarly, the success path of
DiscordSocketClientAdapter.FindChannel(where a guild and text channel are found and aDiscordChannelAdapteris returned) is only reachable with a real Discord connection.The infrastructure-dependent methods of
DiscordSocketClientAdapterare also unreachable in unit tests:LoginAsync/StartAsync/StopAsync/LogoutAsync/SetGameAsync— all call Discord APIWhat needs to happen
Create
BuildBot.Discord.Integration.Tests(or extend an existing integration test project) to cover these paths against a real or stubbed Discord connection.Related to #357.