Inheritance: IConfigReader
コード例 #1
0
        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
        }
コード例 #2
0
        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);
        }
コード例 #3
0
            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);
            }
コード例 #4
0
            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);
            }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: SayTests.cs プロジェクト: Daniel-42/SlackConnector
        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
        }
コード例 #7
0
        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));
        }