public void ThrowInvalidOperationException_GivenBytesWithPaddingOptionInMiddle() { var valueReader = new DhcpBinaryValue(PaddingOptionInMiddleBytes, 0, (byte)PaddingOptionInMiddleBytes.Length); Assert.Throws <InvalidOperationException>( () => valueReader.AsTaggedValueCollection()); }
public void ThrowInvalidOperationException_GivenBytesWithInvalidLengthOfLastValue() { var valueReader = new DhcpBinaryValue(InvalidOptionLengthBytes, 0, (byte)InvalidOptionLengthBytes.Length); Assert.Throws <InvalidOperationException>( () => valueReader.AsTaggedValueCollection()); }
public void ReturnResultWithoutItemsAfterEndByte_GivenBytesWithEndByteInMiddle() { var valueReader = new DhcpBinaryValue(ValidEndByteInMiddleBytes, 0, (byte)ValidEndByteInMiddleBytes.Length); var values = valueReader.AsTaggedValueCollection(); Assert.Equal(1, values.Count); Assert.Equal(9, values.Single().Key); }
public void ReturnResult_GivenBytesWithoutPaddingByte() { var valueReader = new DhcpBinaryValue(ValidNoPaddingOptionBytes, 0, (byte)ValidNoPaddingOptionBytes.Length); var values = valueReader.AsTaggedValueCollection(); Assert.Equal(1, values.Count); Assert.Equal(9, values.Single().Key); }
public void ReturnResultWithMultipleValues_GivenBytesWithMultipleValues() { var valueReader = new DhcpBinaryValue(ValidMultipleOptionsBytes, 0, (byte)ValidMultipleOptionsBytes.Length); var values = valueReader.AsTaggedValueCollection(); Assert.Equal(2, values.Count); Assert.Equal(1, values.First().Key); Assert.Equal(2, values.Last().Key); }