public void PingCommand() { var command = "PING"; var parameter = "tolsun.oulu.fi"; var parsedIRCMessage = new ParsedIrcMessage($"{command} {parameter}"); var ircMessage = IrcMessage.Create(parsedIRCMessage); Assert.IsType <PingMessage>(ircMessage); }
public void NickMessageFromServer() { var oldNick = "WiZ"; var newNick = "Kilroy"; var parsedIRCMessage = new ParsedIrcMessage($":{oldNick} NICK {newNick}"); var ircMessage = IrcMessage.Create(parsedIRCMessage); var nickMessage = Assert.IsType <NickMessage>(ircMessage); Assert.Equal(oldNick, nickMessage.OldNick); Assert.Equal(newNick, nickMessage.NewNick); }
public void QuitMessageFromServer() { var nick = "WiZ"; var message = "Out for lunch"; var parsedIRCMessage = new ParsedIrcMessage($":{nick}[email protected] QUIT :{message}"); var ircMessage = IrcMessage.Create(parsedIRCMessage); var quitMessage = Assert.IsType <QuitMessage>(ircMessage); Assert.Equal(nick, quitMessage.Nick); Assert.Equal(message, quitMessage.Message); }
public void PartMessageFromServer() { var nick = "WiZ"; var channel = "#NetIRC"; var parsedIRCMessage = new ParsedIrcMessage($":{nick}[email protected] PART {channel}"); var ircMessage = IrcMessage.Create(parsedIRCMessage); var partMessage = Assert.IsType <PartMessage>(ircMessage); Assert.Equal(nick, partMessage.Nick); Assert.Equal(channel, partMessage.Channel); }
public void JoinMessageFromServer() { var nick = "WiZ"; var channel = "#Twilight_zone"; var parsedIRCMessage = new ParsedIrcMessage($":{nick} JOIN {channel}"); var ircMessage = IrcMessage.Create(parsedIRCMessage); var joinMessage = Assert.IsType <JoinMessage>(ircMessage); Assert.Equal(nick, joinMessage.Nick); Assert.Equal(channel, joinMessage.Channel); }
public void NoticeMessageFromServer() { var from = "irc.server.net"; var command = "NOTICE"; var target = "WiZ"; var text = "Are you receiving this message ?"; var parsedIRCMessage = new ParsedIrcMessage($":{from} {command} {target} :{text}"); var ircMessage = IrcMessage.Create(parsedIRCMessage); var privMsgMessage = Assert.IsType <NoticeMessage>(ircMessage); Assert.Equal(from, privMsgMessage.From); Assert.Equal(target, privMsgMessage.Target); Assert.Equal(text, privMsgMessage.Message); }
public void PrivMsgMessageFromServer() { var prefix = "[email protected]"; var command = "PRIVMSG"; var target = "WiZ"; var text = "Are you receiving this message ?"; var parsedIRCMessage = new ParsedIrcMessage($":{prefix} {command} {target} :{text}"); var ircMessage = IrcMessage.Create(parsedIRCMessage); var privMsgMessage = Assert.IsType <PrivateMessage>(ircMessage); Assert.Equal(prefix, privMsgMessage.Prefix.Raw); Assert.Equal(target, privMsgMessage.To); Assert.Equal(text, privMsgMessage.Message); }
public void RplNamReplyMessage() { var channel = "#NetIRC"; var nick1 = "NetIRCConsoleClient"; var nick2 = "Fredi_"; var parsedIRCMessage = new ParsedIrcMessage($":irc.server.net 353 NetIRCConsoleClient = {channel} :{nick1} @{nick2}"); var ircMessage = IrcMessage.Create(parsedIRCMessage); var rplNamReplyMessage = Assert.IsType <RplNamReplyMessage>(ircMessage); Assert.Equal(channel, rplNamReplyMessage.Channel); Assert.Equal(2, rplNamReplyMessage.Nicks.Count); Assert.Equal(nick1, rplNamReplyMessage.Nicks.Keys.ElementAt(0)); Assert.Equal(nick2, rplNamReplyMessage.Nicks.Keys.ElementAt(1)); Assert.Equal("@", rplNamReplyMessage.Nicks[nick2]); }
private void Connection_DataReceived(object sender, DataReceivedEventArgs e) { if (string.IsNullOrWhiteSpace(e.Data)) { return; } var rawData = e.Data; OnRawDataReceived?.Invoke(this, e.Data); var parsedIRCMessage = new ParsedIrcMessage(rawData); OnIrcMessageParsed?.Invoke(this, parsedIRCMessage); var serverMessage = IrcMessage.Create(parsedIRCMessage); EventHub.Trigger(serverMessage); }