-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from pureooze/ushamim/sending-messages-part-msg
- Loading branch information
Showing
5 changed files
with
162 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
TwitchEverywhere.UnitTests/Serialization/PartMsgSerializationTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Collections.Immutable; | ||
using TwitchEverywhere.Types; | ||
using TwitchEverywhere.Types.Messages.ImmediateLoadedMessages; | ||
using TwitchEverywhere.Types.Messages.Interfaces; | ||
using TwitchEverywhere.Types.Messages.LazyLoadedMessages; | ||
|
||
namespace TwitchEverywhere.UnitTests.Serialization; | ||
|
||
[TestFixture] | ||
public class PartMsgSerializationTest { | ||
|
||
[Test] | ||
public void LazyLoadedPartMsgSerialization() { | ||
const string channel = "channel"; | ||
const string message = | ||
":ronni!ronni@ronni.tmi.twitch.tv PART #dallas"; | ||
LazyLoadedPartMsg lazyLoadedPartMsg = new( channel: channel, message: message ); | ||
|
||
Assert.That( lazyLoadedPartMsg.RawMessage, Is.EqualTo( message ) ); | ||
} | ||
|
||
[Test] | ||
public void MessageDeletedSuccessfully_ImmediateLoadedPartMsg_SerializationToIRCMessage() { | ||
|
||
ImmediateLoadedPartMsg immediateLoadedPartMsg = new( | ||
channel: "dallas", | ||
user: "ronni" | ||
); | ||
|
||
Assert.That( | ||
immediateLoadedPartMsg.RawMessage, | ||
Is.EqualTo( | ||
":ronni!ronni@ronni.tmi.twitch.tv PART #dallas" | ||
) | ||
); | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
TwitchEverywhere.UnitTests/Serialization/UserStateMsgSerializationTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Collections.Immutable; | ||
using TwitchEverywhere.Types; | ||
using TwitchEverywhere.Types.Messages.ImmediateLoadedMessages; | ||
using TwitchEverywhere.Types.Messages.Interfaces; | ||
using TwitchEverywhere.Types.Messages.LazyLoadedMessages; | ||
|
||
namespace TwitchEverywhere.UnitTests.Serialization; | ||
|
||
[TestFixture] | ||
public class UserStateMsgSerializationTest { | ||
|
||
[Test] | ||
public void LazyLoadedUserStateMsgSerialization() { | ||
const string channel = "channel"; | ||
const string message = | ||
"@badge-info=;badges=staff/1;color=#0D4200;display-name=ronni;emote-sets=0,33,50,237,793,2126,3517,4578,5569,9400,10337,12239;mod=1;subscriber=1;turbo=1;user-type=staff :tmi.twitch.tv USERSTATE #dallas"; | ||
LazyLoadedUserStateMsg lazyLoadedClearChatMsg = new( channel: channel, message: message ); | ||
|
||
Assert.That( lazyLoadedClearChatMsg.RawMessage, Is.EqualTo( message ) ); | ||
} | ||
|
||
[Test] | ||
public void MessageDeletedSuccessfully_ImmediateLoadedUserStateMsg_SerializationToIRCMessage() { | ||
|
||
ImmediateLoadedUserStateMsg immediateLoadedNoticeMsg = new( | ||
channel: "dallas", | ||
badges: new List<Badge> { | ||
new ( "staff", "1" ) | ||
}.ToImmutableList(), | ||
color: "#0D4200", | ||
displayName: "ronni", | ||
emoteSets: new List<string> { | ||
"0", "33", "50", "237", "793", "2126", "3517", "4578", "5569", "9400", "10337", "12239" | ||
}.ToImmutableList(), | ||
mod: true, | ||
subscriber: true, | ||
turbo: true, | ||
userType: UserType.Staff | ||
); | ||
|
||
Assert.That( | ||
immediateLoadedNoticeMsg.RawMessage, | ||
Is.EqualTo( | ||
"@badge-info=;badges=staff/1;color=#0D4200;display-name=ronni;emote-sets=0,33,50,237,793,2126,3517,4578,5569,9400,10337,12239;mod=1;subscriber=1;turbo=1;user-type=staff :tmi.twitch.tv USERSTATE #dallas" | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters