Ejemplo n.º 1
0
        public void TestClassABroadcastAddress()
        {
            Mock <UnicastIPAddressInformation> unicastInfoMock = new Mock <UnicastIPAddressInformation>();

            IPAddress ipAddr = IPAddress.Parse("10.1.2.5");
            IPAddress ipMask = IPAddress.Parse("255.0.0.0");

            // UnicastIPInfo
            unicastInfoMock.SetupGet(n => n.Address).Returns(ipAddr);
            unicastInfoMock.SetupGet(n => n.IPv4Mask).Returns(ipMask);
            UnicastIPAddressInformation unicastInfo = unicastInfoMock.Object;

            IPAddress result = Networks.GetIPv4BroadcastAddress(unicastInfo);

            Assert.AreEqual(IPAddress.Parse("10.255.255.255"), result);
        }