コード例 #1
0
        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>()));
                }
            }
        }
コード例 #2
0
        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>()));
                }
            }
        }
コード例 #3
0
        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))));
                }
            }
        }