Esempio n. 1
0
        public void ThrowInvalidOperationException_GivenInvalidTypeAndLengthCombination(Type outputType, byte length)
        {
            var valueReader = new DhcpBinaryValue(TestBytes, 0, length);

            Assert.Throws <InvalidOperationException>(
                () => valueReader.As(outputType));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public void ReturnValue_GivenValidTypeAndLengthCombination(Type outputType, byte length, object expectedValue)
        {
            var valueReader = new DhcpBinaryValue(TestBytes, 0, length);

            Assert.Equal(expectedValue, valueReader.As(outputType));
        }