public void SendOffMessage_SentMessage_ShouldBeOutboundStateChangeMessage() { using (var messageSender = Mock.Of <IMessageSender>()) { using (var unicastMessageSender = new UnicastMessageSender(messageSender)) { var networkDevice = CreateNetworkDevice(); unicastMessageSender.SendOffMessage(networkDevice); Mock.Get(messageSender).Verify(ms => ms.Send(It.IsAny <OutboundStateChangeMessage>(), It.IsAny <IPAddress>())); } } }
public void SendOffMessage_SentMessage_StateShouldBeOff() { using (var messageSender = Mock.Of <IMessageSender>()) { using (var unicastMessageSender = new UnicastMessageSender(messageSender)) { var networkDevice = CreateNetworkDevice(); unicastMessageSender.SendOffMessage(networkDevice); Mock.Get(messageSender).Verify(ms => ms.Send(It.Is <IOutboundMessage>(m => m.GetPayload().Last() == 0), It.IsAny <IPAddress>())); } } }
public void SendOffMessage_Destination_ShouldMatch() { using (var messageSender = Mock.Of <IMessageSender>()) { using (var unicastMessageSender = new UnicastMessageSender(messageSender)) { var networkDevice = CreateNetworkDevice(); unicastMessageSender.SendOffMessage(networkDevice); Mock.Get(messageSender).Verify(ms => ms.Send(It.IsAny <IOutboundMessage>(), It.Is <IPAddress>(ip => ip.Equals(networkDevice.IPAddress)))); } } }