This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from noobot/dm-channel-missing-issue-34
Dm channel missing issue 34
- Loading branch information
Showing
20 changed files
with
484 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/SlackConnector.Tests.Unit/SlackConnectionTests/InboundMessageTests/DmJoinedTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System.Threading.Tasks; | ||
using NUnit.Framework; | ||
using Should; | ||
using SlackConnector.Connections.Models; | ||
using SlackConnector.Connections.Sockets.Messages.Inbound; | ||
using SlackConnector.Models; | ||
using SpecsFor.ShouldExtensions; | ||
|
||
namespace SlackConnector.Tests.Unit.SlackConnectionTests.InboundMessageTests | ||
{ | ||
internal class given_new_dm_channel : BaseTest<DmChannelJoinedMessage> | ||
{ | ||
private SlackChatHub _lastHub; | ||
|
||
protected override void Given() | ||
{ | ||
base.Given(); | ||
|
||
SUT.OnChatHubJoined += hub => | ||
{ | ||
_lastHub = hub; | ||
return Task.FromResult(false); | ||
}; | ||
|
||
InboundMessage = new DmChannelJoinedMessage | ||
{ | ||
Channel = new Im | ||
{ | ||
User = "test-user", | ||
Id = "channel-id", | ||
IsIm = true, | ||
IsOpen = true | ||
} | ||
}; | ||
} | ||
|
||
[Test] | ||
public void then_should_raised_event_with_expected_channel_information() | ||
{ | ||
var expectedChatHub = new SlackChatHub | ||
{ | ||
Id = "channel-id", | ||
Name = "@test-user", | ||
Type = SlackChatHubType.DM | ||
}; | ||
_lastHub.ShouldLookLike(expectedChatHub); | ||
} | ||
|
||
[Test] | ||
public void then_should_add_channel_to_connected_hubs() | ||
{ | ||
SUT.ConnectedHubs.ContainsKey("channel-id").ShouldBeTrue(); | ||
SUT.ConnectedHubs["channel-id"].ShouldEqual(_lastHub); | ||
} | ||
} | ||
} |
Oops, something went wrong.