예제 #1
0
 public Task <AppResponse> ProcessAsync(SlackCallback callback)
 {
     return(Task.FromResult(new AppResponse {
         ImmediateMessage = new SlackMessage {
             text = "DUMMY"
         }
     }));
 }
        public Task <AppResponse> ProcessAsync(SlackCallback callback)
        {
            var response = new AppResponse();

            response.ResponseUrlMessages.Add(new SlackMessage {
                text = "DUMMY"
            });
            return(Task.FromResult(response));
        }
예제 #3
0
        internal static HttpContext GetIncomingActionContext(SlackCallback callback = null)
        {
            var context = new DefaultHttpContext();

            context.Request.Method = "POST";
            context.Request.Headers.Add("Content-Type", "application/x-www-form-urlencoded");

            // https://stackoverflow.com/questions/45959605/inspect-defaulthttpcontext-body-in-unit-test-situation
            // Must set the Response.Body to a new MemoryStream because DefaultHttpContext's default is Stream.Null
            // that ignores all reads and writes.
            context.Response.Body = new MemoryStream();

            if (callback != null)
            {
                var dict = new Dictionary <string, StringValues> {
                    { "payload", WebUtility.UrlEncode(callback.ToJson()) }
                };
                context.Request.Form = new FormCollection(dict);
            }

            return(context);
        }
예제 #4
0
 public Task <AppResponse> ProcessAsync(SlackCallback callback) => Task.FromResult((AppResponse)null);
예제 #5
0
 public Task <AppResponse> ProcessAsync(SlackCallback callback) => Task.FromResult(new AppResponse());