public void ReceiveData_ValidTarget( )
        {
            var iface = new SUTest(fakeDevice, "eth1");

            var received   = false;
            var fakePacket = new Abstract.Fakes.StubINetPacket( );

            ((Abstract.Fakes.StubINetDevice)fakeDevice).ReceiveDataINetPacketINetHwInterface = (INetPacket iNetPacket, INetHwInterface myIface) => received = fakePacket == iNetPacket;

            fakePacket.DestinationHardwareAddressGet = () => iface.HardwareAddress;

            iface.ReceiveData(fakePacket);

            Assert.IsTrue(received);
        }
        public void SendData( )
        {
            using (ShimsContext.Create( )) {
                var iface = new SUTest(fakeDevice, "eth1");

                var             sended      = false;
                INetPacket      fakePacket  = new Abstract.Fakes.StubINetPacket( );
                INetDevice      otherDevice = new Abstract.Fakes.StubINetDevice( );
                INetLgInterface otherIface  = new SUTest(otherDevice, "eth1");
                Simulator.Fakes.ShimNetLgInterface.AllInstances.ReceiveDataINetPacket =
                    (SUTest instance, INetPacket iNetPacket) => {
                    Assert.AreEqual(iface.HardwareAddress, iNetPacket.SourceHardwareAddress);
                    Assert.AreEqual(otherIface.HardwareAddress, iNetPacket.DestinationHardwareAddress);
                    Assert.AreEqual(fakePacket.SourceAddress, iNetPacket.SourceAddress);
                    Assert.AreEqual(fakePacket.DestinationAddress, iNetPacket.DestinationAddress);
                    sended = true;
                };
                iface.Connect(otherIface);

                iface.SendData(fakePacket);

                Assert.IsTrue(sended);
            }
        }
        public void SendData( )
        {
            using (ShimsContext.Create( )) {
                var iface = new SUTest(fakeDevice, "eth1");

                var sended = false;
                INetPacket fakePacket = new Abstract.Fakes.StubINetPacket( );
                INetDevice otherDevice = new Abstract.Fakes.StubINetDevice( );
                INetLgInterface otherIface = new SUTest(otherDevice, "eth1");
                Simulator.Fakes.ShimNetLgInterface.AllInstances.ReceiveDataINetPacket =
                    (SUTest instance, INetPacket iNetPacket) => {
                        Assert.AreEqual(iface.HardwareAddress, iNetPacket.SourceHardwareAddress);
                        Assert.AreEqual(otherIface.HardwareAddress, iNetPacket.DestinationHardwareAddress);
                        Assert.AreEqual(fakePacket.SourceAddress, iNetPacket.SourceAddress);
                        Assert.AreEqual(fakePacket.DestinationAddress, iNetPacket.DestinationAddress);
                        sended = true;
                    };
                iface.Connect(otherIface);

                iface.SendData(fakePacket);

                Assert.IsTrue(sended);
            }
        }
        public void ReceiveData_WrongTarget( )
        {
            var iface = new SUTest(fakeDevice, "eth1");

            var received = false;
            var fakePacket = new Abstract.Fakes.StubINetPacket( );
            ((Abstract.Fakes.StubINetDevice)fakeDevice).ReceiveDataINetPacketINetHwInterface = (INetPacket iNetPacket, INetHwInterface myIface) => received = fakePacket == iNetPacket;

            var otherIface = new SUTest(fakeDevice, "eth2");
            fakePacket.DestinationHardwareAddressGet = ( ) => otherIface.HardwareAddress;

            iface.ReceiveData(fakePacket);

            Assert.IsFalse(received);
        }