Example #1
0
        private void JoinAuction(XMPPConnection connection, string itemId)
        {
            string formattedAuctionId = AuctionId(itemId, connection);
            Chat   chat = connection.ChatManager.CreateChat(formattedAuctionId, null);

            const int BID_AMOUNT = 35;
            IAuction  auction    = new XMPPAuction(chat);

            chat.AddIMessageListener(
                new AuctionMessageTranslator(
                    connection.UserName,
                    new Domain.AuctionSniper(auction, new SniperStateDisplayer(this))));
            auction.Join();
        }
Example #2
0
        public void ReceivesEventsFromAuctionServerAfterJoining()
        {
            IAuctionEventListener eventListenerMock = Substitute.For <IAuctionEventListener>();

            IAuction auction = new XMPPAuction(connection, item, Substitute.For <IXMPPFailureReporter>());

            auction.AddAuctionEventListener(eventListenerMock);

            auction.Join();
            HasReceivedJoinRequestFromSniper(string.Format(ITEM_ID_AS_LOGIN, item.Identifier));
            AnnounceClosed();

            //Sometimes test finishes before the client receives the Close message. So we set buffer for client to receive and process the message.
            Thread.Sleep(1000);

            eventListenerMock.Received(1).AuctionClosed();
        }