예제 #1
0
        public void PingHandler_HandleMessage_SendsPongReply()
        {
            var connectionMock = new Mock<IDdpConnectionSender>();
            var collectionMock = new Mock<ICollectionManager>();
            var resultHandlerMock = new Mock<IResultHandler>();

            var pingMessage = new Ping {Id = "testPing"};

            var handler = new PingHandler();

            handler.HandleMessage(connectionMock.Object, collectionMock.Object, resultHandlerMock.Object,
                JsonConvert.SerializeObject(pingMessage));

            connectionMock.Verify(connection => connection.SendObject(It.IsAny<Pong>()));
        }
예제 #2
0
        public void PingHandler_CanHandle_InvalidMessageType()
        {
            var handler = new PingHandler();

            Assert.IsFalse(handler.CanHandle("invalid"));
        }
예제 #3
0
        public void PingHandler_CanHandle_ValidMessage()
        {
            var handler = new PingHandler();

            Assert.IsTrue(handler.CanHandle("ping"));
        }