Exemple #1
0
        public static void EnumConvert_ToByteChecked()
        {
            Assert.Equal(byte.MinValue, EnumConvert.ToByteChecked(ByteEnum.MinValue));
            Assert.Equal(byte.MaxValue, EnumConvert.ToByteChecked(ByteEnum.MaxValue));

            Assert.Throws <OverflowException>(() => EnumConvert.ToByteChecked(SByteEnum.MinValue));
            Assert.Throws <OverflowException>(() => EnumConvert.ToByteChecked(UInt16Enum.MaxValue));
        }