Example #1
0
        public async Task should_join_channel()
        {
            // given
            if (string.IsNullOrEmpty(Config.Slack.TestUserName))
            {
                throw new InvalidConfiguration("TestUserName is missing from config");
            }

            var users = await SlackConnection.GetUsers();

            string userId = users.First(x => x.Name.Equals(Config.Slack.TestUserName, StringComparison.InvariantCultureIgnoreCase)).Id;

            // when
            SlackChatHub result = await SlackConnection.JoinDirectMessageChannel(userId);

            // then
            result.ShouldNotBeNull();

            var dmChannel = SlackConnection.ConnectedDM($"@{Config.Slack.TestUserName}");

            dmChannel.ShouldNotBeNull();
            await SlackConnection.Say(new BotMessage { ChatHub = dmChannel, Text = "Wuzzup - testing in da haus" });
        }