예제 #1
0
        public static void EnumConvert_ToEnumCheckedOfInt16()
        {
            Assert.Equal(Int16Enum.MinValue, EnumConvert.ToEnumChecked <Int16Enum>(short.MinValue));
            Assert.Equal(Int16Enum.MaxValue, EnumConvert.ToEnumChecked <Int16Enum>(short.MaxValue));

            Assert.Throws <OverflowException>(() => EnumConvert.ToEnumChecked <Int16Enum>(int.MinValue));
            Assert.Throws <OverflowException>(() => EnumConvert.ConvertToEnumChecked <Int16Enum>(ushort.MaxValue));
        }