public void SlashCommandParsesCorrectly() { var command = new Interaction.SlashCommand(payload + "&test=1"); Assert.True(command.Payload.ContainsKey("test")); Assert.Equal("1", command.Payload["test"]); }
public void CorrectlyWraps() { var command = new Interaction.SlashCommand(payload + "&ssl_check=1"); Assert.True(command.IsSslCheck); Assert.Equal("U2147483697", command.UserId); Assert.Equal("Steve", command.Username); Assert.Equal("C2147483705", command.ChannelId); Assert.Equal("test", command.ChannelName); }
public async Task RespondSendCorrectRequest() { var command = new Interaction.SlashCommand(payload + "&test=1"); var message = new InteractionMessage(ResponseType.InChannel) { Text = "It's 80 degrees right now." }; var client = new HttpClient(new ActionHandler(async req => { Assert.Equal(HttpMethod.Post, req.Method); Assert.Equal(command.ResponseUrl, req.RequestUri.ToString()); Assert.Equal(JsonConvert.SerializeObject(message), await req.Content.ReadAsStringAsync()); }, new WebApiResponse { OK = true })); await command.Respond(message, client); }