public void NumericTest() { TypeHelper helper = new TypeHelper(typeof(Convert)); IConvertible src = 123; // All types from SByte to Decimal can convert to each other // for (int from = 0; from < NumericTypes.Length; ++from) { Type typeFrom = NumericTypes[from]; object test = src.ToType(typeFrom, null); for (int to = 0; to < NumericTypes.Length; ++to) { if (from == to) continue; Type typeTo = NumericTypes[to]; MethodInfo mi = helper.GetMethod("To" + typeTo.Name, bindingFlags, typeFrom); Assert.IsNotNull(mi, string.Format("Missed To{0}({1})", typeTo.Name, typeFrom.Name)); Assert.AreEqual(123, mi.Invoke(null, new object[] { test })); } } }