コード例 #1
0
        public void ReadValueFromGivenOffset()
        {
            var valueReader = new DhcpBinaryValue(TestBytes, 2, 8);

            Assert.Equal(IPAddress.Parse("34.51.68.85"), valueReader.AsIpAddressPairList().Single().Item1);
            Assert.Equal(IPAddress.Parse("102.119.136.153"), valueReader.AsIpAddressPairList().Single().Item2);
        }
コード例 #2
0
        public void ReturnSingleIpPair_GivenBytesForOneIpPair()
        {
            var valueReader = new DhcpBinaryValue(TestBytes, 0, 8);

            var ipPair = valueReader.AsIpAddressPairList().Single();

            Assert.Equal(IPAddress.Parse("0.17.34.51"), ipPair.Item1);
            Assert.Equal(IPAddress.Parse("68.85.102.119"), ipPair.Item2);
        }
コード例 #3
0
        public void ThrowInvalidOperationException_GivenInvalidLength(byte length)
        {
            var bytes = new byte[10];

            var valueReader = new DhcpBinaryValue(bytes, 0, length);

            Assert.Throws <InvalidOperationException>(
                () => valueReader.AsIpAddressPairList());
        }
コード例 #4
0
        public void ReturnTwoIps_GivenBytesForTwoIp()
        {
            var valueReader = new DhcpBinaryValue(TestBytes, 0, 16);

            var ipAddressPairs = valueReader.AsIpAddressPairList();

            Assert.Equal(IPAddress.Parse("0.17.34.51"), ipAddressPairs[0].Item1);
            Assert.Equal(IPAddress.Parse("68.85.102.119"), ipAddressPairs[0].Item2);

            Assert.Equal(IPAddress.Parse("136.153.170.187"), ipAddressPairs[1].Item1);
            Assert.Equal(IPAddress.Parse("204.221.238.255"), ipAddressPairs[1].Item2);
        }