Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiWebSocket #54

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local.properties
.classpath
.settings/
.loadpath
.vs

# External tool builders
.externalToolBuilders/
Expand Down
27 changes: 0 additions & 27 deletions Attachment.cs

This file was deleted.

28 changes: 0 additions & 28 deletions Channel.cs

This file was deleted.

19 changes: 0 additions & 19 deletions Conversation.cs

This file was deleted.

14 changes: 0 additions & 14 deletions DirectMessageConversation.cs

This file was deleted.

5 changes: 3 additions & 2 deletions IntegrationTest/Connect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using IntegrationTest.Helpers;
using Polly;
using SlackAPI.WebSocketMessages;
using SlackAPI.Models;

namespace IntegrationTest
{
Expand Down Expand Up @@ -36,7 +37,7 @@ public void TestGetAccessToken()
var authCode = _config.Slack.AuthCode;

// act
var accessTokenResponse = GetAccessToken(clientId, clientSecret, "", authCode);
var accessTokenResponse = GetAccessToken(clientId, clientSecret, string.Empty, authCode);

// assert
Assert.IsNotNull(accessTokenResponse, "accessTokenResponse != null");
Expand Down Expand Up @@ -85,7 +86,7 @@ public void TestConnectPostAndDelete()

// then
Assert.IsNotNull(deletedResponse, "No response was found");
Assert.IsTrue(deletedResponse.ok, "Message not deleted!");
Assert.IsTrue(deletedResponse.Ok, "Message not deleted!");
Assert.AreEqual(channel, deletedResponse.channel, "Got invalid channel? Something's not right here...");
Assert.AreEqual(messageTimestamp, deletedResponse.ts, "Got invalid time stamp? Something's not right here...");
}
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTest/Helpers/ClientHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static SlackSocketClient GetClient(string authToken)
var wait = new EventWaitHandle(false, EventResetMode.ManualReset);

var client = new SlackSocketClient(authToken);
client.Connect(x =>
client.Connect((x,sc) =>
{
Console.WriteLine("RTM Start");
}, () =>
Expand Down
33 changes: 17 additions & 16 deletions IntegrationTest/Helpers/SlackMother.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
namespace IntegrationTest.Helpers
{
using SlackAPI;
using SlackAPI;
using SlackAPI.Models;

namespace IntegrationTest.Helpers
{
public class SlackMother
{
public static Attachment[] SomeAttachments => new[]
{
new Attachment()
{
fallback = "Required plain-text summary of the attachment.",
color = "#36a64f",
pretext = "Optional text that appears above the attachment block",
author_name = "Bobby Tables",
author_link = "http://flickr.com/bobby/",
author_icon = "http://flickr.com/icons/bobby.jpg",
title = "Slack API Documentation",
title_link = "https://api.slack.com/",
text = "Optional text that appears within the attachment",
fields = new[]
Fallback = "Required plain-text summary of the attachment.",
Color = "#36a64f",
Pretext = "Optional text that appears above the attachment block",
AuthorName = "Bobby Tables",
AuthorLink = "http://flickr.com/bobby/",
AuthorIcon = "http://flickr.com/icons/bobby.jpg",
Title = "Slack API Documentation",
TitleLink = "https://api.slack.com/",
Text = "Optional text that appears within the attachment",
Fields = new[]
{
new Field() { title = "Priority", value = "High", @short = false },
new Field() { title = "Priority", value = "High", @short = true },
new Field() { title = "Priority", value = "High", @short = true }
new Field() { Title = "Priority", Value = "High", IsShort = false },
new Field() { Title = "Priority", Value = "High", IsShort = true },
new Field() { Title = "Priority", Value = "High", IsShort = true }
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions IntegrationTest/JoinDirectMessageChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public void ShouldJoinDirectMessageChannel()
var client = ClientHelper.GetClient(_config.Slack.UserAuthToken);

string userName = _config.Slack.DirectMessageUser;
string user = client.Users.First(x => x.name.Equals(userName, StringComparison.InvariantCultureIgnoreCase)).id;
string user = client.Users.First(x => x.Name.Equals(userName, StringComparison.InvariantCultureIgnoreCase)).Id;

// when
EventWaitHandle wait = new EventWaitHandle(false, EventResetMode.ManualReset);
client.JoinDirectMessageChannel(response =>
{
Assert.IsTrue(response.ok, "Error while joining user channel");
Assert.IsTrue(!string.IsNullOrEmpty(response.channel.id), "We expected a channel id to be returned");
Assert.IsTrue(response.Ok, "Error while joining user channel");
Assert.IsTrue(!string.IsNullOrEmpty(response.channel.Id), "We expected a channel id to be returned");
wait.Set();
}, user);

Expand Down
6 changes: 3 additions & 3 deletions IntegrationTest/PostMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace IntegrationTest
{
using SlackAPI;

using SlackAPI.Models;
[TestClass]
public class PostMessage
{
Expand Down Expand Up @@ -41,7 +41,7 @@ public void SimpleMessageDelivery()
}

// then
Assert.IsTrue(actual.ok, "Error while posting message to channel. ");
Assert.IsTrue(actual.Ok, "Error while posting message to channel. ");
Assert.AreEqual(actual.message.text, "Hi there!");
Assert.AreEqual(actual.message.type, "message");
}
Expand All @@ -68,7 +68,7 @@ public void Attachments()
}

// then
Assert.IsTrue(actual.ok, "Error while posting message to channel. ");
Assert.IsTrue(actual.Ok, "Error while posting message to channel. ");
}
}
}
6 changes: 3 additions & 3 deletions IntegrationTest/Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace IntegrationTest
{
using SlackAPI;

using SlackAPI.Models;
[TestClass]
public class Update
{
Expand Down Expand Up @@ -42,7 +42,7 @@ public void SimpleUpdate()
}

// then
Assert.IsTrue(actual.ok, "Error while posting message to channel. ");
Assert.IsTrue(actual.Ok, "Error while posting message to channel. ");
Assert.AreEqual(actual.message.text, "[changed]");
Assert.AreEqual(actual.message.type, "message");
}
Expand All @@ -56,7 +56,7 @@ private string PostedMessage(SlackSocketClient client)
response =>
{
messageId = response.ts;
Assert.IsTrue(response.ok, "Error while posting message to channel. ");
Assert.IsTrue(response.Ok, "Error while posting message to channel. ");
sync.Proceed();
},
_config.Slack.TestChannel,
Expand Down
3 changes: 2 additions & 1 deletion JavascriptBotsToArray.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using SlackAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
Loading