예제 #1
0
        public void SetEmptySubOptions_GivenValueWithNoSubOptions()
        {
            var bytes       = new byte[] { 0x01 };
            var binaryValue = new DhcpBinaryValue(bytes, 0, bytes.Length);

            var option = new DhcpNetWareSubOptionsOption(binaryValue);

            Assert.NotNull(option.SubOptions);
        }
예제 #2
0
        public void SetStateFromFirstOption(byte firstByte, NetWareIpState expectedState)
        {
            var bytes       = new[] { firstByte };
            var binaryValue = new DhcpBinaryValue(bytes, 0, bytes.Length);

            var option = new DhcpNetWareSubOptionsOption(binaryValue);

            Assert.Equal(expectedState, option.State);
        }
예제 #3
0
        public void ReadNsqBroadcastSubOption_GivenFirstByteWhichAllowsSubOptions(NetWareIpState state)
        {
            var bytes       = new byte[] { (byte)state, 0x05, 0x01, 0x01 };
            var binaryValue = new DhcpBinaryValue(bytes, 0, bytes.Length);

            var option = new DhcpNetWareSubOptionsOption(binaryValue);

            var subOption = option.SubOptions.OfType <NetWareNsqBroadcastSubOption>().Single();

            Assert.True(subOption.ShouldPerformNearestQuery);
        }
예제 #4
0
        public void ReadPrimaryDss_GivenFirstByteWhichAllowsSubOptions(NetWareIpState state)
        {
            var bytes       = new byte[] { (byte)state, 0x0b, 0x04, 0xc0, 0xa8, 0x01, 0x23 };
            var binaryValue = new DhcpBinaryValue(bytes, 0, bytes.Length);

            var option = new DhcpNetWareSubOptionsOption(binaryValue);

            var subOption = option.SubOptions.OfType <NetWarePrimaryDssSubOption>().Single();

            Assert.Equal(IPAddress.Parse("192.168.1.35"), subOption.PrimaryDssServerAddress);
        }
예제 #5
0
        public void ReadSupportVersion11_GivenFirstByteWhichAllowsSubOptions(NetWareIpState state)
        {
            var bytes       = new byte[] { (byte)state, 0x0a, 0x01, 0x01 };
            var binaryValue = new DhcpBinaryValue(bytes, 0, bytes.Length);

            var option = new DhcpNetWareSubOptionsOption(binaryValue);

            var subOption = option.SubOptions.OfType <NetWareSupportVersion11SubOption>().Single();

            Assert.True(subOption.ShouldSupport11);
        }
예제 #6
0
        public void ReadAutoRetriesSeconds_GivenFirstByteWhichAllowsSubOptions(NetWareIpState state)
        {
            var bytes       = new byte[] { (byte)state, 0x09, 0x01, 0xc0 };
            var binaryValue = new DhcpBinaryValue(bytes, 0, bytes.Length);

            var option = new DhcpNetWareSubOptionsOption(binaryValue);

            var subOption = option.SubOptions.OfType <NetWareAutoRetriesDelaySubOption>().Single();

            Assert.Equal((byte)192, subOption.RetryDelay.TotalSeconds);
        }
예제 #7
0
        public void ReadNearestNwip_GivenFirstByteWhichAllowsSubOptions(NetWareIpState state)
        {
            var bytes       = new byte[] { (byte)state, 0x07, 0x08, 0xc0, 0xa8, 0x01, 0x23, 0xc0, 0xa8, 0x01, 0x24 };
            var binaryValue = new DhcpBinaryValue(bytes, 0, bytes.Length);

            var option = new DhcpNetWareSubOptionsOption(binaryValue);

            var subOption = option.SubOptions.OfType <NetWareNearestNwipServerSubOption>().Single();

            Assert.Equal(IPAddress.Parse("192.168.1.35"), subOption.NearestNwipServerAddresses[0]);
            Assert.Equal(IPAddress.Parse("192.168.1.36"), subOption.NearestNwipServerAddresses[1]);
        }