public void SendEventNotConnected() { // If: I send an event when the protocol channel isn't connected // Then: I should get an exception var jh = new JsonRpcHost(GetChannelBase(null, null).Object); Assert.Throws <InvalidOperationException>(() => jh.SendEvent(CommonObjects.EventType, CommonObjects.TestMessageContents.DefaultInstance)); }
public void SendEvent() { // Setup: Create a Json RPC Host with a connected channel var jh = new JsonRpcHost(GetChannelBase(null, null, true).Object); // If: I send an event jh.SendEvent(CommonObjects.EventType, CommonObjects.TestMessageContents.DefaultInstance); // Then: The message should be added to the output queue Assert.Single(jh.outputQueue.ToArray()); var m = jh.outputQueue.ToArray()[0]; Assert.Equal(CommonObjects.TestMessageContents.SerializedContents, m.Contents); Assert.Equal(CommonObjects.EventType.MethodName, m.Method); }