public void ReadValueFromGivenOffset() { var bytes = new byte[] { 0x00, 0x00, 0x01, 0x00 }; var valueReader = new DhcpBinaryValue(bytes, 2, 1); Assert.True(valueReader.AsBoolean()); }
public void ReturnValue_GivenValidLength(byte binaryValue, bool expectedValue) { var bytes = new[] { binaryValue }; var valueReader = new DhcpBinaryValue(bytes, 0, 1); Assert.Equal(expectedValue, valueReader.AsBoolean()); }
public void ThrowInvalidOperationException_GivenInvalidLength(byte length) { var bytes = new byte[10]; var valueReader = new DhcpBinaryValue(bytes, 0, length); Assert.Throws <InvalidOperationException>( () => valueReader.AsBoolean()); }