public CompareColumnResult GoGoCompareColumnAction(object target, string tableValue) { if (tableValue == ConstantStrings.IgnoreCell) return new CompareColumnResult(); var thisObject = new ThisObject(target); var compareResult = new CompareColumnResult(); var expectedValue = Translator.Translate(_info, tableValue); var actualValue = thisObject == null ? null : _info.GetValue(thisObject, null); 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 CompareColumnResult GoGoCompareColumnAction(object target, string tableValue) { if (tableValue == ConstantStrings.IgnoreCell) { return(new CompareColumnResult()); } var thisObject = new ThisObject(target); var compareResult = new CompareColumnResult(); var expectedValue = Translator.Translate(_info, tableValue); var actualValue = thisObject == null ? null : _info.GetValue(thisObject, null); 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 CompareColumnResult GoGoCompareColumnAction(object target) { var thisObject = new ThisObject(target); // While the record is missing... this column isn't an error as it is n/a var compareResult = new CompareColumnResult(); var actualValue = thisObject == null ? null : _info.GetValue(thisObject, null); compareResult.ActualPrint = ToStringHelper.SafeToString(actualValue); compareResult.IsError = false; return compareResult; }
public CompareColumnResult GoGoCompareColumnAction(object target) { var thisObject = new ThisObject(target); // While the record is missing... this column isn't an error as it is n/a var compareResult = new CompareColumnResult(); var actualValue = thisObject == null ? null : _info.GetValue(thisObject, null); compareResult.ActualPrint = ToStringHelper.SafeToString(actualValue); compareResult.IsError = false; return(compareResult); }