예제 #1
0
        public async Task <ApiResponse> GetChatyBotInfo()
        {
            var statusResponse = await _chatyApiService.GetChatyBotStatus();

            return(statusResponse == null
                ? ApiResponse.NoContent(HttpStatusCode.InternalServerError)
                : ApiResponse.ActionResult(statusResponse));
        }
예제 #2
0
        public async Task should_get_bot_status()
        {
            var botStatus = await _normalChatyApiService.GetChatyBotStatus();

            Assert.Equal(1, _httpClient.RequestsSent.Count);
            Assert.Contains(_httpClient.RequestsSent, req => req.RequestUri.PathAndQuery == "/bot/info");

            Assert.NotNull(botStatus);
            Assert.Equal("https://weixin.com/2o3kl3z", botStatus.QrCode);
            Assert.Equal("Someone", botStatus.Name);
        }