示例#1
0
        public async Task should_connect()
        {
            SlackConnection.IsConnected.ShouldBeTrue();

            await SlackConnection.Close();

            SlackConnection.IsConnected.ShouldBeFalse();
        }
示例#2
0
        public async Task should_connect_and_stuff()
        {
            // given

            // when
            SlackConnection.OnDisconnect      += SlackConnector_OnDisconnect;
            SlackConnection.OnMessageReceived += SlackConnectorOnMessageReceived;

            // then
            SlackConnection.IsConnected.ShouldBeTrue();
            //Thread.Sleep(TimeSpan.FromMinutes(1));

            // when
            await SlackConnection.Close();

            SlackConnection.IsConnected.ShouldBeFalse();
        }
示例#3
0
        private async Task should_not_close_websocket_when_websocket_is_disconnected(
            [Frozen] Mock <IWebSocketClient> webSocket,
            SlackConnection slackConnection)
        {
            // given
            webSocket
            .Setup(x => x.IsAlive)
            .Returns(false);

            var info = GetDummyConnectionInformation(webSocket);
            await slackConnection.Initialise(info);

            // when
            await slackConnection.Close();

            // then
            webSocket.Verify(x => x.Close(), Times.Never);
        }
示例#4
0
        public async Task connect_and_wait_5_mins()
        {
            // given

            // when
            SlackConnection.OnDisconnect      += SlackConnector_OnDisconnect;
            SlackConnection.OnMessageReceived += SlackConnectorOnMessageReceived;
            SlackConnection.OnReaction        += SlackConnectionOnOnReaction;

            // then
            SlackConnection.IsConnected.ShouldBeTrue();
            await Task.Delay(TimeSpan.FromMinutes(5));

            // when
            await SlackConnection.Close();

            SlackConnection.IsConnected.ShouldBeFalse();
        }