Esempio n. 1
0
        public async Task WhenCallingAuthTestThenServerReceive(SlackLibrary.Connections.Models.AuthTest wantedResponse)
        {
            var port = GetRandomPort;

            using (var server = new SlackServer(port))
            {
                var mockedResponse = new SlackLibrary.Connections.Responses.AuthTestResponse()
                {
                    Ok     = true,
                    TeamId = wantedResponse.TeamId,
                    Team   = wantedResponse.Team,
                    Url    = wantedResponse.Url,
                    User   = wantedResponse.User,
                    UserId = wantedResponse.UserId
                };
                server.MockDefaultAuthTest(mockedResponse);

                ClientConstants.SlackApiHost = $"http://localhost:{port}";

                var client = new FlurlAuthClient(new ResponseVerifier());

                var response = await client.Test("SLACK_KEY");

                response.ShouldDeepEqual(wantedResponse);
            }
        }
Esempio n. 2
0
        public async Task should_call_auth_test_with_flurl()
        {
            var config = new ConfigReader().GetConfig();
            var client = new FlurlAuthClient(new ResponseVerifier());

            // when
            var response = await client.Test(config.Slack.ApiToken);

            // then
            response.ShouldNotBeNull();
        }