示例#1
0
        public async Task HandlesResponseHeaderCorrectly()
        {
            var handler = new ActionMessageHandler(req =>
            {
                var response = new HttpResponseMessage(HttpStatusCode.Accepted);
                response.Headers.Add("X-Amzn-RequestID", "xxx");
                return(response);
            });

            var client = new HttpClient(handler)
            {
                BaseAddress = new Uri(SkillMessageClient.EuropeEndpoint, UriKind.Absolute)
            };
            var messageRequest = new SkillMessageClient(client);

            var message = new Message(TestMessageData, 60);

            Assert.Equal("xxx", await messageRequest.Send(message, UserId));
        }
示例#2
0
        public async Task SendsCorrectRequest()
        {
            var handler = new ActionMessageHandler(req =>
            {
                Assert.Equal(HttpMethod.Post, req.Method);
                Assert.Equal(new Uri(new Uri(SkillMessageClient.EuropeEndpoint), UserId).ToString(), req.RequestUri.ToString());
                var response = new HttpResponseMessage(HttpStatusCode.Accepted);
                response.Headers.Add("X-Amzn-RequestID", "xxx");
                return(response);
            });

            var client = new HttpClient(handler)
            {
                BaseAddress = new Uri(SkillMessageClient.EuropeEndpoint, UriKind.Absolute)
            };
            var messageRequest = new SkillMessageClient(client);

            var message = new Message(TestMessageData, 60);
            await messageRequest.Send(message, UserId);
        }