protected virtual bool AssertEmpty(Table table, Row row, string columnName, string expected, object actual) { if (Strings.IsEmpty(expected)) { if (actual == null) { return(true); } if (actual is string && Strings.IsEmpty((string)actual)) { return(true); } Assertie.Fail("M_Fixture_Temp_ObjectValidator_AssertEquals", table, row, columnName, "", actual, GetType(actual)); } if (NULL.Equals(expected)) { if (actual != null) { Assertie.Fail("M_Fixture_Temp_ObjectValidator_AssertEquals", table, row, columnName, NULL, actual, GetType(actual)); } return(true); } if (EMPTY.Equals(expected)) { if (actual == null || !(actual is string) || ((string)actual).Length > 0) { Assertie.Fail("M_Fixture_Temp_ObjectValidator_AssertEquals", table, row, columnName, EMPTY, ToStringInternal(actual), GetType(actual)); } return(true); } return(false); }
private object ToObject(Type type, Type componentType, string textValue) { if (textValue == null || NULL.Equals(textValue)) { return(null); } if (EMPTY.Equals(textValue)) { return(""); } if (type.IsArray) { if (HasArraySeparator(textValue) || !Section.HasTable(textValue)) { return(ToArray(componentType, textValue)); } else { return(InvokeMethod(componentType, textValue, "GetArray")); } } else if (typeof(IList).IsAssignableFrom(type)) { if (HasArraySeparator(textValue) || !Section.HasTable(textValue)) { return(ToList(type, componentType, textValue)); } else { IList list = (IList)type.GetConstructor(EmptyTypes).Invoke(EmptyObjects); MethodInfo method = parent.GetType().GetMethod("AddTo"); method.MakeGenericMethod(componentType).Invoke(parent, new object[] { list, textValue }); return(list); } } else if (TypeConverter.IsConvertible(type)) { return(TypeConverter.ChangeType(textValue, type)); } else if (typeof(object).Equals(type)) { return(textValue); } else { return(InvokeMethod(type, new string[] { textValue }, "GetObject")); } }