public void should_send_typing_indicator() { // given var config = new ConfigReader().GetConfig(); var slackConnector = new SlackConnector(); var connection = slackConnector.Connect(config.Slack.ApiToken).Result; SlackChatHub channel = connection.ConnectedChannels().First(x => x.Name.Equals("#general", StringComparison.InvariantCultureIgnoreCase)); // when connection.IndicateTyping(channel).Wait(); // then }
public void should_connect_and_stuff() { // given var config = new ConfigReader().GetConfig(); var slackConnector = new SlackConnector(); // when var connection = slackConnector.Connect(config.Slack.ApiToken).Result; connection.OnDisconnect += SlackConnector_OnDisconnect; connection.OnMessageReceived += SlackConnectorOnOnMessageReceived; // then Assert.That(connection.IsConnected, Is.True); }
public async void should_connect_and_get_users() { // given var config = new ConfigReader().GetConfig(); var slackConnector = new SlackConnector(); // when var connection = await slackConnector.Connect(config.Slack.ApiToken); var users = await connection.GetUsers(); // then Assert.That(users.Any(u => u.Online == true), Is.True); }
public async void should_connect_and_get_channels() { // given var config = new ConfigReader().GetConfig(); var slackConnector = new SlackConnector(); // when var connection = await slackConnector.Connect(config.Slack.ApiToken); var channels = await connection.GetChannels(); // then Assert.That(channels.Any(), Is.True); }
public void should_join_channel() { // given var config = new ConfigReader().GetConfig(); var slackConnector = new SlackConnector(); var connection = slackConnector.Connect(config.Slack.ApiToken).Result; // when SlackChatHub result = connection.JoinDirectMessageChannel(config.Slack.TestUserId).Result; // then Assert.That(result, Is.Not.Null); }
public void should_say_something_on_channel() { // given var config = new ConfigReader().GetConfig(); var slackConnector = new SlackConnector(); var connection = slackConnector.Connect(config.Slack.ApiToken).Result; var message = new BotMessage { Text = "Test text for INT test", ChatHub = connection.ConnectedChannels().First(x => x.Name.Equals("#general", StringComparison.InvariantCultureIgnoreCase)) }; // when connection.Say(message).Wait(); // then }
public void should_join_channel() { // given var config = new ConfigReader().GetConfig(); if (string.IsNullOrEmpty(config.Slack.TestUserId)) { Assert.Inconclusive("TestUserId is missing from config"); } var slackConnector = new SlackConnector(); var connection = slackConnector.Connect(config.Slack.ApiToken).Result; // when SlackChatHub result = connection.JoinDirectMessageChannel(config.Slack.TestUserId).Result; // then Assert.That(result, Is.Not.Null); List<SlackChatHub> dms = connection.ConnectedDMs().ToList(); Assert.That(dms.Count, Is.GreaterThan(1)); }