コード例 #1
0
        public async Task should_call_expected_url_with_given_slack_key()
        {
            // given
            const string slackKey = "I-is-da-key-yeah";

            var expectedResponse = new HandshakeResponse
            {
                Ok           = true,
                WebSocketUrl = "some-url"
            };

            _httpTest.RespondWithJson(expectedResponse);

            // when
            var result = await _handshakeClient.FirmShake(slackKey);

            // then
            _responseVerifierMock.Verify(x => x.VerifyResponse(Looks.Like(expectedResponse)));
            _httpTest
            .ShouldHaveCalled(ClientConstants.SlackApiHost.AppendPathSegment(FlurlHandshakeClient.HANDSHAKE_PATH))
            .WithQueryParamValue("token", slackKey)
            .Times(1);

            result.ToExpectedObject().ShouldEqual(expectedResponse);
        }
コード例 #2
0
        public async Task should_perform_handshake_with_flurl()
        {
            // given
            var config = new ConfigReader().GetConfig();
            var client = new FlurlHandshakeClient(new ResponseVerifier());

            // when
            HandshakeResponse response = await client.FirmShake(config.Slack.ApiToken);

            // then
            response.ShouldNotBeNull();
            response.WebSocketUrl.ShouldNotBeEmpty();
        }