public void SendAndReceiveChatMessages() { var testuser = new Jid("testuser", XMPP_HOST, "auction"); var chatClient1 = new XmppChatClient(testuser, "pass"); var messageReceivedEvent = new ManualResetEvent(false); var message = string.Empty; chatClient1.OnChatMessageReceived += (sender, msg) => chatClient1.SendMessageTo(msg.From, msg.Body); chatClient1.Login(); var auctionitem1 = new Jid("auction-item1", XMPP_HOST, "auction"); var chatClient2 = new XmppChatClient(auctionitem1, "auction"); chatClient2.OnChatMessageReceived += (s, m) => { message = m.Body; messageReceivedEvent.Set(); }; chatClient2.Login(); chatClient2.SendMessageTo(testuser, "hello"); TimeSpan timeout = 4.Seconds(); Assert.That(messageReceivedEvent.WaitOne(timeout), "Did not receive message within {0}", timeout); Assert.That(message, Is.EqualTo("hello")); }
public void LoginWithInvalidUserId() { try { var connection = new XmppChatClient(new Jid("invalid", XMPP_HOST, "auction"), "pass"); connection.Login(); Assert.Fail("should have thrown xmppexection when loggin with invalid user id"); } catch (XmppException e) { Assert.That(e.Message.Contains("Auth error")); } }
void JoinAuction() { xmppClient.Login(); var itemJid = new Jid(this.ItemId, XMPP_HOST, RESOURCE); IAuction auction = new XmppAuction(xmppClient, itemJid); var auctionMessageTranslator = new AuctionMessageTranslator(new Domain.AuctionSniper(this, auction)); xmppClient.OnChatMessageReceived += (s, msg) => auctionMessageTranslator.Process(msg); auction.Join(); ShowStatus("joining"); }
public void LoinToValidXMPPServer() { var connection = new XmppChatClient(new Jid("testuser", XMPP_HOST, "auction"), "pass"); connection.Login(); }
public void ThrowsExceptionWhenConnectionCannotBeMade() { var connection = new XmppChatClient(new Jid("invalid@invalidhost/resource"), "blah"); connection.Login(); }
public void StartSellingItem() { auctionChat.Login(); }