ModelBinding\ModelBindingHelperTest.cs (23)
977var outValue = ModelBindingHelper.ConvertTo(new object[] { 1 }, typeof(IntEnum), culture: null);
980Assert.Equal(IntEnum.Value1, outValue);
984[InlineData(1, typeof(IntEnum), IntEnum.Value1)]
988[InlineData(1UL, typeof(IntEnum), IntEnum.Value1)]
992[InlineData((short)1, typeof(IntEnum), IntEnum.Value1)]
993[InlineData((ushort)1, typeof(IntEnum), IntEnum.Value1)]
994[InlineData(int.MaxValue, typeof(IntEnum?), IntEnum.MaxValue)]
995[InlineData(null, typeof(IntEnum?), null)]
1022var outValue = ModelBindingHelper.ConvertTo(new object[] { "1" }, typeof(IntEnum), culture: null);
1025Assert.Equal(IntEnum.Value1, outValue);
1034var outValue = ModelBindingHelper.ConvertTo(new object[] { "Value1" }, typeof(IntEnum), culture: null);
1037Assert.Equal(IntEnum.Value1, outValue);
1133var outValue = ModelBindingHelper.ConvertTo(value, typeof(IntEnum[]), culture: null);
1136var result = Assert.IsType<IntEnum[]>(outValue);
1138Assert.Equal(IntEnum.Value1, result[0]);
1139Assert.Equal(IntEnum.Value0, result[1]);
1176[InlineData(typeof(IntEnum?))]
1241[InlineData(typeof(IntEnum))]