public void ThrowInvalidOperationException_GivenInvalidTypeAndLengthCombination(Type outputType, byte length) { var valueReader = new DhcpBinaryValue(TestBytes, 0, length); Assert.Throws <InvalidOperationException>( () => valueReader.As(outputType)); }
public void ReturnFalse_GivenUnsupportedType(Type type) { var bytes = new byte[10]; var valueReader = new DhcpBinaryValue(bytes, 0, 10); var ex = Assert.Throws <NotSupportedException>( () => valueReader.As(type)); Assert.Contains("types", ex.Message); Assert.Contains("Int32", ex.Message); Assert.Contains("Int16", ex.Message); }
public void ReturnValue_GivenValidTypeAndLengthCombination(Type outputType, byte length, object expectedValue) { var valueReader = new DhcpBinaryValue(TestBytes, 0, length); Assert.Equal(expectedValue, valueReader.As(outputType)); }