public void SendOnMessage_SentMessage_StateShouldBeOn() { using (var messageSender = Mock.Of <IMessageSender>()) { using (var unicastMessageSender = new UnicastMessageSender(messageSender)) { var networkDevice = CreateNetworkDevice(); unicastMessageSender.SendOnMessage(networkDevice); Mock.Get(messageSender).Verify(ms => ms.Send(It.Is <IOutboundMessage>(m => m.GetPayload().Last() == 1), It.IsAny <IPAddress>())); } } }
public void SendOnMessage_Destination_ShouldMatch() { using (var messageSender = Mock.Of <IMessageSender>()) { using (var unicastMessageSender = new UnicastMessageSender(messageSender)) { var networkDevice = CreateNetworkDevice(); unicastMessageSender.SendOnMessage(networkDevice); Mock.Get(messageSender).Verify(ms => ms.Send(It.IsAny <IOutboundMessage>(), It.Is <IPAddress>(ip => ip.Equals(networkDevice.IPAddress)))); } } }
public void SendOnMessage_SentMessage_ShouldBeOutboundStateChangeMessage() { using (var messageSender = Mock.Of <IMessageSender>()) { using (var unicastMessageSender = new UnicastMessageSender(messageSender)) { var networkDevice = CreateNetworkDevice(); unicastMessageSender.SendOnMessage(networkDevice); Mock.Get(messageSender).Verify(ms => ms.Send(It.IsAny <OutboundStateChangeMessage>(), It.IsAny <IPAddress>())); } } }