コード例 #1
0
        public async Task InvalidHeadersProduceUnknownRequestType()
        {
            var request = Substitute.For <Microsoft.AspNetCore.Http.HttpRequest>();

            request.Headers.Returns(new HeaderDictionary());
            var endpoint = new HttpRequestEndpoint("xxx");
            var result   = await endpoint.Process(request);

            Assert.Equal(SlackRequestType.UnknownRequest, result.Type);
        }
コード例 #2
0
        public async Task CommandParsesCorrectly()
        {
            var request = Substitute.For <Microsoft.AspNetCore.Http.HttpRequest>();

            request.Headers.Returns(new HeaderDictionary
            {
                { RequestVerifier.SignatureHeaderName, "v0=a2114d57b48eac39b9ad189dd8316235a7b4a8d21a10bd27519666489c69b503" },
                { RequestVerifier.TimestampHeaderName, "1531420618" },
                { "Content-Type", "application/x-www-form-urlencoded" }
            });
            SetSubstituteBody(request);
            var endpoint = new HttpRequestEndpoint(TestSigningSecret, false, TimeSpan.FromDays(5000));
            var result   = await endpoint.Process(request);

            Assert.Equal(SlackRequestType.Command, result.Type);
        }