public void OnInitializedFiresFromInitializeMessage() { bool timedOut, disconnected, triggered = false; var connection = new Connection("http://foo.com"); TransportHelper.ProcessResponse(connection, "{\"S\":1, \"M\":[]}", out timedOut, out disconnected, () => { triggered = true; }); Assert.True(triggered); }
public void ProcessResponseCapturesOnReceivedExceptions() { bool timedOut, disconnected; var ex = new Exception(); var connection = new Mock <Client.IConnection>(MockBehavior.Strict); connection.Setup(c => c.OnReceived(It.IsAny <JToken>())).Throws(ex); connection.Setup(c => c.OnError(ex)); connection.Setup(c => c.MarkLastMessage()); // PersistentResponse TransportHelper.ProcessResponse(connection.Object, "{\"M\":{}}", out timedOut, out disconnected); // HubResponse (WebSockets) TransportHelper.ProcessResponse(connection.Object, "{\"I\":{}}", out timedOut, out disconnected); connection.VerifyAll(); }