public void ForwardsLineFromSourceToSink() { var source = _session.WithMockSource(); var sink = _session.WithMockSink(); var lineEvent = new LineReadyEventArgs("Line", "originIdentifier", null); // Raise a lineEvent from source source.Raise(responseConsumer => responseConsumer.RaiseUserEvent += null, lineEvent); // Verify that the handler on sink was called exactly once. sink.Verify(lineConsumer => lineConsumer.HandleUserEvent(_session, lineEvent), Times.Once()); }
public void DetachesFromSourceAfterDisconnect() { var source = _session.WithMockSource(); var sink = _session.WithMockSink(); var lineEvent = new LineReadyEventArgs("Line", "originIdentifier", null); var disconnectEvent = new DisconnectEventArgs("originIdentifier"); // Raise a lineEvent from source source.Raise(responseConsumer => responseConsumer.RaiseUserEvent += null, lineEvent); // Verify that the handler on sink was called exactly once. sink.Verify(lineConsumer => lineConsumer.HandleUserEvent(_session, lineEvent), Times.Once()); // Raise a disconnectEvent from source source.Raise(responseConsumer => responseConsumer.RaiseUserEvent += null, disconnectEvent); // Raise a lineEvent from source source.Raise(responseConsumer => responseConsumer.RaiseUserEvent += null, lineEvent); // Verify that the handler on sink was called exactly once, and not a second time. sink.Verify(lineConsumer => lineConsumer.HandleUserEvent(_session, lineEvent), Times.Once()); }
protected void OnRaiseLineReadyEvent(LineReadyEventArgs args) { OnRaiseUserEvent(args); }
/// <summary> /// Event listener for LineReadyEvents. /// /// Reraises the event as coming from this account. /// </summary> /// <param name='sender'> /// The sender of the event. Under normal usage, should correspond to the source that this /// object is aware of. /// </param> /// <param name='args'> /// The event arguments, containing the line that is ready. /// </param> public void HandleLineReadyEvent(object sender, LineReadyEventArgs args) { OnRaiseLineReadyEvent(args); }