public CompareColumnResult GoGoCompareColumnAction(object target, string tableValue) { if (tableValue == ConstantStrings.IgnoreCell) { return(new CompareColumnResult()); } var compareResult = new CompareColumnResult(); var expectedValue = Translator.Translate(_info, tableValue); expectedValue = SetTranslator.Translate(_info, target, expectedValue); var actualValue = GetActual(target); compareResult.ExpectedPrint = ToStringHelper.SafeToString(expectedValue); compareResult.ActualPrint = ToStringHelper.SafeToString(actualValue); // Refactor to be blah = blah try { Assert.AreEqual(TypeConversion.SafeConvert(expectedValue, actualValue), actualValue); } catch (Exception) { compareResult.IsError = true; compareResult.ErrorMessage = "Error on Property " + _info.Name + ", Expected '" + compareResult.ExpectedPrint + "', Actual '" + compareResult.ActualPrint + "'"; } return(compareResult); }
public void GoGoCreateColumnAction(object target, string tableValue) { if (tableValue == ConstantStrings.IgnoreCell) { return; } var value = Translator.Translate(_info, tableValue); value = SetTranslator.Translate(_info, target, value); try { _info.SetValue(target, value, new object[] { _lookUp }); } catch (ArgumentException e) { var message = string.Format( "Unable to set value of indexer on {0} to value of \"{1}\" to type {2}", target.GetType(), value == null ? "null" : value.ToString(), _info.PropertyType.FullName); throw new Exception(message, e); } }
public void GoGoCreateColumnAction(object target, string tableValue) { if (tableValue == ConstantStrings.IgnoreCell) { return; } var value = Translator.Translate(_info, tableValue); // Convert the Translated value to the type of the targeted property. // Translators guilty of not honoring the PropertyInfo ... Tag, Deep Link, Dates, etcetera value = SetTranslator.Translate(_info, target, value); try { _info.SetValue(target, value, null); } catch (ArgumentException e) { var message = string.Format( "Unable to set value of property {0} on {1} to value of \"{2}\" to type {3}", _info.Name, target.GetType(), value == null ? "null" : value.ToString(), _info.PropertyType.FullName); throw new Exception(message, e); } }