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); }
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); }
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); }
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); }
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); }
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); }
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]); }