Skip to content

Commit 2389db1

Browse files
committed
MultiWebSocket
Change: objects class move to the Models folder, List will all the slackChannel(Group, DM, Channels). Father class SlackChannel from all channels(Group, DM, Channels). Fix bug when the socket receive a message with type null. Fix the error when the slackSocketClient try open socket with LoginReponse is not Ok, Add more events, and now the event pass back the slackclient/slacksocketclient
1 parent ea9f946 commit 2389db1

File tree

96 files changed

+754
-681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+754
-681
lines changed

Attachment.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

Channel.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

DirectMessageConversation.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

IntegrationTest/Connect.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using IntegrationTest.Helpers;
77
using Polly;
88
using SlackAPI.WebSocketMessages;
9+
using SlackAPI.Models;
910

1011
namespace IntegrationTest
1112
{
@@ -85,7 +86,7 @@ public void TestConnectPostAndDelete()
8586

8687
// then
8788
Assert.IsNotNull(deletedResponse, "No response was found");
88-
Assert.IsTrue(deletedResponse.ok, "Message not deleted!");
89+
Assert.IsTrue(deletedResponse.Ok, "Message not deleted!");
8990
Assert.AreEqual(channel, deletedResponse.channel, "Got invalid channel? Something's not right here...");
9091
Assert.AreEqual(messageTimestamp, deletedResponse.ts, "Got invalid time stamp? Something's not right here...");
9192
}

IntegrationTest/Helpers/ClientHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static SlackSocketClient GetClient(string authToken)
1313
var wait = new EventWaitHandle(false, EventResetMode.ManualReset);
1414

1515
var client = new SlackSocketClient(authToken);
16-
client.Connect(x =>
16+
client.Connect((x,sc) =>
1717
{
1818
Console.WriteLine("RTM Start");
1919
}, () =>

IntegrationTest/Helpers/SlackMother.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
namespace IntegrationTest.Helpers
2-
{
3-
using SlackAPI;
1+
using SlackAPI;
2+
using SlackAPI.Models;
43

4+
namespace IntegrationTest.Helpers
5+
{
56
public class SlackMother
67
{
78
public static Attachment[] SomeAttachments => new[]
89
{
910
new Attachment()
1011
{
11-
fallback = "Required plain-text summary of the attachment.",
12-
color = "#36a64f",
13-
pretext = "Optional text that appears above the attachment block",
14-
author_name = "Bobby Tables",
15-
author_link = "http://flickr.com/bobby/",
16-
author_icon = "http://flickr.com/icons/bobby.jpg",
17-
title = "Slack API Documentation",
18-
title_link = "https://api.slack.com/",
19-
text = "Optional text that appears within the attachment",
20-
fields = new[]
12+
Fallback = "Required plain-text summary of the attachment.",
13+
Color = "#36a64f",
14+
Pretext = "Optional text that appears above the attachment block",
15+
AuthorName = "Bobby Tables",
16+
AuthorLink = "http://flickr.com/bobby/",
17+
AuthorIcon = "http://flickr.com/icons/bobby.jpg",
18+
Title = "Slack API Documentation",
19+
TitleLink = "https://api.slack.com/",
20+
Text = "Optional text that appears within the attachment",
21+
Fields = new[]
2122
{
22-
new Field() { title = "Priority", value = "High", @short = false },
23-
new Field() { title = "Priority", value = "High", @short = true },
24-
new Field() { title = "Priority", value = "High", @short = true }
23+
new Field() { Title = "Priority", Value = "High", IsShort = false },
24+
new Field() { Title = "Priority", Value = "High", IsShort = true },
25+
new Field() { Title = "Priority", Value = "High", IsShort = true }
2526
}
2627
}
2728
};

IntegrationTest/JoinDirectMessageChannel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public void ShouldJoinDirectMessageChannel()
3131
EventWaitHandle wait = new EventWaitHandle(false, EventResetMode.ManualReset);
3232
client.JoinDirectMessageChannel(response =>
3333
{
34-
Assert.IsTrue(response.ok, "Error while joining user channel");
35-
Assert.IsTrue(!string.IsNullOrEmpty(response.channel.id), "We expected a channel id to be returned");
34+
Assert.IsTrue(response.Ok, "Error while joining user channel");
35+
Assert.IsTrue(!string.IsNullOrEmpty(response.channel.Id), "We expected a channel id to be returned");
3636
wait.Set();
3737
}, user);
3838

IntegrationTest/PostMessage.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace IntegrationTest
1010
{
1111
using SlackAPI;
12-
12+
using SlackAPI.Models;
1313
[TestClass]
1414
public class PostMessage
1515
{
@@ -41,7 +41,7 @@ public void SimpleMessageDelivery()
4141
}
4242

4343
// then
44-
Assert.IsTrue(actual.ok, "Error while posting message to channel. ");
44+
Assert.IsTrue(actual.Ok, "Error while posting message to channel. ");
4545
Assert.AreEqual(actual.message.text, "Hi there!");
4646
Assert.AreEqual(actual.message.type, "message");
4747
}
@@ -68,7 +68,7 @@ public void Attachments()
6868
}
6969

7070
// then
71-
Assert.IsTrue(actual.ok, "Error while posting message to channel. ");
71+
Assert.IsTrue(actual.Ok, "Error while posting message to channel. ");
7272
}
7373
}
7474
}

IntegrationTest/Update.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace IntegrationTest
77
{
88
using SlackAPI;
9-
9+
using SlackAPI.Models;
1010
[TestClass]
1111
public class Update
1212
{
@@ -42,7 +42,7 @@ public void SimpleUpdate()
4242
}
4343

4444
// then
45-
Assert.IsTrue(actual.ok, "Error while posting message to channel. ");
45+
Assert.IsTrue(actual.Ok, "Error while posting message to channel. ");
4646
Assert.AreEqual(actual.message.text, "[changed]");
4747
Assert.AreEqual(actual.message.type, "message");
4848
}
@@ -56,7 +56,7 @@ private string PostedMessage(SlackSocketClient client)
5656
response =>
5757
{
5858
messageId = response.ts;
59-
Assert.IsTrue(response.ok, "Error while posting message to channel. ");
59+
Assert.IsTrue(response.Ok, "Error while posting message to channel. ");
6060
sync.Proceed();
6161
},
6262
_config.Slack.TestChannel,

JavascriptBotsToArray.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
using SlackAPI.Models;
2+
using System;
23
using System.Collections.Generic;
34
using System.Linq;
45
using System.Text;

0 commit comments

Comments
 (0)