Пример #1
0
 public void OneMessageForBothTest()
 {
     messenger = messengerMocker.Object;
     FeedSubscriber.SubscribeSocket(serverMocker.Object, receiverId1, receiverId1.ToString());
     FeedSubscriber.SubscribeSocket(serverMocker.Object, receiverId2, receiverId2.ToString());
     messenger.SendMessage(receiverId1, "The Cake is A LIE!");
     messenger.SendMessage(receiverId2, "For The Horde!");
     Assert.AreEqual(2, countMessagesToServer);
 }
Пример #2
0
 public void GetNotificiationOfflineForMessageSentTest()
 {
     messenger = messengerMocker.Object;
     FeedSubscriber.SubscribeSocket(serverMocker.Object, receiverId1, receiverId1.ToString());
     messenger.SendMessage(receiverId1, "The Cake is A LIE!");
     messenger.SendMessage(receiverId2, "For The Horde!");
     Assert.AreEqual(1, countMessagesToServer);
     FeedSubscriber.SubscribeSocket(serverMocker.Object, receiverId2, receiverId2.ToString());
     Assert.AreEqual(2, countMessagesToServer);
 }
Пример #3
0
        public void SignUpThenGetMessageNotificationForMessageSentTest()
        {
            var newUserid = RegisterEvent();

            serverMocker.Setup(x => x.GetMessage(newUserid.ToString(), "You have got new message pending in your mailbox!"))
            .Callback(SendMessageToServer);
            messengerMocker.Setup(x => x.SendMessage(newUserid, It.IsAny <string>())).Callback(() => { Publisher.Instance.NotifyMessageReceived(newUserid); });
            messenger = messengerMocker.Object;
            FeedSubscriber.SubscribeSocket(serverMocker.Object, receiverId2, receiverId2.ToString());
            messenger.SendMessage(newUserid, "The Cake is A LIE!");
            messenger.SendMessage(receiverId2, "For The Horde!");
            Assert.AreEqual(1, countMessagesToServer);
            try
            {
                FeedSubscriber.SubscribeSocket(serverMocker.Object, newUserid, newUserid.ToString());
                Assert.AreEqual(2, countMessagesToServer);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }