Example #1
0
        public static void ConvertTo_LongFlagsEnum_EnumArray()
        {
            EnumConverter converter = new EnumConverter(typeof(LongFlagsEnum));
            LongFlagsEnum value     = LongFlagsEnum.Bit62 | LongFlagsEnum.Bit63;

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

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

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

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