public void FreenodeConnectionWithSSL() { Skip.IfNot(ENABLEDIT, reason: "Integration tests not enabled"); List <string> rawMessages = new List <string>(); var helpr = new User("helpr-bot", username: "******", realname: "HelpR"); var freenodeConfiguration = new ServerConfiguration(helpr, "leguin.freenode.net", port: 6697, useSSL: true); var freenode = new RemoteServer(freenodeConfiguration); freenode.IncomingMessageEvent += (_, x) => { if (x.Command == Command.ERR_NICKNAMEINUSE) { ServerEventHandlers.UniqueNickErrorHandler(freenode, x); } }; freenode.IncomingMessageEvent += (_, x) => rawMessages.Add(x.RawMessage); freenode.ConnectAsync().Wait(); Thread.Sleep(1000); freenode.SendMessageAsync(new SimpleMessage($"PRIVMSG {helpr.Nickname} :Test Message 123")).Wait(); for (int i = 0; i < DURING_TIMEOUT; i++) { Thread.Sleep(1000); } freenode.Disconnect(); string messagesConcat = string.Join(", ", rawMessages); Assert.True(rawMessages.Any(m => m.Contains("Test Message 123")), $"Messages: \"{messagesConcat}\""); Thread.Sleep(AFTER_TIMEOUT); }
public void FreenodeConnectionWithSASLandCAP() { Skip.IfNot(ENABLEDIT, reason: "Integration tests not enabled"); Skip.If(PASSWORD == null, reason: "NickServ password wasn't found."); List <string> rawMessages = new List <string>(); var helpr = new User("helpr-bot", username: "******", realname: "HelpR", nickServUsername: "******", nickServPassword: PASSWORD); var freenodeConfiguration = new ServerConfiguration(helpr, "leguin.freenode.net", port: 6697, useSSL: true, identifyNickServ: true, useSASL: true); var freenode = new RemoteServer(freenodeConfiguration); var client = new IrcClient(freenode); freenode.IncomingMessageEvent += (_, x) => { if (x.Command == Command.ERR_NICKNAMEINUSE) { ServerEventHandlers.UniqueNickErrorHandler(freenode, x); } }; freenode.IncomingMessageEvent += (_, x) => rawMessages.Add(x.RawMessage); client.ConnectAllAsync().Wait(); Thread.Sleep(1000); freenode.SendMessageAsync(new SimpleMessage($"PRIVMSG {helpr.Nickname} :Test Message 123")).Wait(); for (int i = 0; i < DURING_TIMEOUT; i++) { Thread.Sleep(1000); } freenode.Disconnect(); string messagesConcat = string.Join(", ", rawMessages); Assert.True(rawMessages.Any(m => m.Contains("SASL authentication successful")), $"Messages: \"{messagesConcat}\""); Assert.True(rawMessages.Any(m => m.Contains("You are now logged in as") && m.Contains("helpr")), $"Messages: \"{messagesConcat}\""); Thread.Sleep(AFTER_TIMEOUT); }