public void SimpleUpdate() { // given var client = ClientHelper.GetClient(_config.Slack.UserAuthToken); var messageId = PostedMessage(client); UpdateResponse actual = null; // when using (var sync = new InSync()) { client.Update( response => { actual = response; sync.Proceed(); }, messageId, _config.Slack.TestChannel, "[changed]", attachments: SlackMother.SomeAttachments, as_user: true); } // then Assert.IsTrue(actual.Ok, "Error while posting message to channel. "); Assert.AreEqual(actual.message.text, "[changed]"); Assert.AreEqual(actual.message.type, "message"); }
public void UpdatePresence() { var client = ClientHelper.GetClient(_config.Slack.UserAuthToken); using (var sync = new InSync()) { client.EmitPresence((presence) => { presence.AssertOk(); sync.Proceed(); }, Presence.away); } }
private string PostedMessage(SlackSocketClient client) { string messageId = null; using (var sync = new InSync()) { client.PostMessage( response => { messageId = response.ts; Assert.IsTrue(response.Ok, "Error while posting message to channel. "); sync.Proceed(); }, _config.Slack.TestChannel, "Hi there!", as_user: true); } return messageId; }
public void Attachments() { // given var client = ClientHelper.GetClient(_config.Slack.UserAuthToken); PostMessageResponse actual = null; // when using (var sync = new InSync()) { client.PostMessage( response => { actual = response; sync.Proceed(); }, _config.Slack.TestChannel, string.Empty, attachments: SlackMother.SomeAttachments); } // then Assert.IsTrue(actual.Ok, "Error while posting message to channel. "); }
public void SimpleMessageDelivery() { // given var client = ClientHelper.GetClient(_config.Slack.UserAuthToken); PostMessageResponse actual = null; // when using (var sync = new InSync()) { client.PostMessage( response => { actual = response; sync.Proceed(); }, _config.Slack.TestChannel, "Hi there!"); } // then Assert.IsTrue(actual.Ok, "Error while posting message to channel. "); Assert.AreEqual(actual.message.text, "Hi there!"); Assert.AreEqual(actual.message.type, "message"); }