Example #1
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();
        }