public void CanRecieveMessagesFromExternalSource() { TcpMessageService tcpMessageService = new TcpMessageService(null, null); List<string> messages = new List<string>(); tcpMessageService.MessageRecieved("hello"); tcpMessageService.OnMessageRecieved.Subscribe(message => messages.Add(message)); tcpMessageService.MessageRecieved("hello"); Assert.IsTrue(messages.Count == 1); }
public void CanReceiveMessagesFromSubscribedClients() { ITwitterMessageService twitterMessageService = new TcpMessageService(null, null); ITwitterHandler twitterHandler = new TwitterHandler(); twitterHandler.Add(twitterMessageService); List<string> messages = new List<string>(); twitterMessageService.OnMessageRecieved.Subscribe(message => messages.Add(message)); twitterMessageService.MessageRecieved("is there somebody out there?"); Assert.IsTrue(messages.Count == 1); }