public void WhenUnsubscribe_WithWrongName_NoException() { // Arrange Mock <IConnectionManager> manager = new Mock <IConnectionManager>(); Realtime.Channel target = new Realtime.Channel("test", "client", manager.Object); Message[] receivedMessage = null; Action <Message[]> action = (m) => receivedMessage = m; target.Subscribe("test", action); // Act target.Unsubscribe("test test", action); }
public void WhenUnsubscribe_MessageSubscribersNotCalled() { // Arrange Mock <IConnectionManager> manager = new Mock <IConnectionManager>(); Realtime.Channel target = new Realtime.Channel("test", "client", manager.Object); Message[] receivedMessage = null; Action <Message[]> action = (m) => receivedMessage = m; target.Subscribe("test", action); // Act target.Unsubscribe("test", action); Message[] targetMessages = new Message[] { new Message("test", null), new Message("test2", null) }; manager.Raise(c => c.MessageReceived += null, new ProtocolMessage(ProtocolMessage.MessageAction.Message, "test") { Messages = targetMessages }); // Assert Assert.Null(receivedMessage); }