Exemple #1
0
        public static void ConvertTo_ULongFlagsEnum_EnumArray()
        {
            EnumConverter  converter = new EnumConverter(typeof(ULongFlagsEnum));
            ULongFlagsEnum value     = ULongFlagsEnum.Bit62 | ULongFlagsEnum.Bit63;

            Enum[] result = (Enum[])converter.ConvertTo(null, null, value, typeof(Enum[]));
            Assert.Equal(new Enum[] { ULongFlagsEnum.Bit62, ULongFlagsEnum.Bit63 }, result);
        }
Exemple #2
0
        public static void ConvertFrom_ULongFlagsEnum_String()
        {
            EnumConverter  converter = new EnumConverter(typeof(ULongFlagsEnum));
            string         str       = $"{ULongFlagsEnum.Bit62}, {ULongFlagsEnum.Bit63}";
            ULongFlagsEnum result    = (ULongFlagsEnum)converter.ConvertFrom(null, null, str);

            Assert.Equal(ULongFlagsEnum.Bit62 | ULongFlagsEnum.Bit63, result);
        }
Exemple #3
0
        public static void ConvertFrom_ULongFlagsEnum_EnumArray()
        {
            EnumConverter converter = new EnumConverter(typeof(ULongFlagsEnum));

            Enum[]         arr    = new Enum[] { ULongFlagsEnum.Bit62, ULongFlagsEnum.Bit63 };
            ULongFlagsEnum result = (ULongFlagsEnum)converter.ConvertFrom(null, null, arr);

            Assert.Equal(ULongFlagsEnum.Bit62 | ULongFlagsEnum.Bit63, result);
        }