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>())); }
public void PingHandler_CanHandle_InvalidMessageType() { var handler = new PingHandler(); Assert.IsFalse(handler.CanHandle("invalid")); }
public void PingHandler_CanHandle_ValidMessage() { var handler = new PingHandler(); Assert.IsTrue(handler.CanHandle("ping")); }