/// <summary> /// Write property value to the StringBuilder. Separate by tabs. /// </summary> /// <param name="prodData">Product data object.</param> /// <param name="inputCol">Input data column.</param> /// <param name="bob">StringBuilder to be modified.</param> /// <returns>Modified StringBuilder object.</returns> private static StringBuilder WritePropertyValue(ProductData prodData, FileDataColumn inputCol, StringBuilder bob) { var properties = prodData.GetType().GetProperties(); foreach (var prop in properties) { if (prop.GetCustomAttribute <DisplayAttribute>().Name != inputCol.HeaderTitle) { continue; } var value = prop.GetValue(prodData); value = value == null ? string.Empty : GetValidStringPresentation(value); bob.AppendFormat("{0}\t", value); } return(bob); }
public void HasSameNumberOfValuesShouldReturnFalse() { var dataColumns = new List <FileDataColumn>(); var colOne = new FileDataColumn("Project"); colOne.Values.Add("1"); colOne.Values.Add("2"); colOne.Values.Add("2"); dataColumns.Add(colOne); var colTwo = new FileDataColumn("Complexity"); colTwo.Values.Add("Simple"); colTwo.Values.Add("Moderate"); dataColumns.Add(colTwo); Type[] parameterTypes = { typeof(IEnumerable <FileDataColumn>) }; object[] parameterValues = { dataColumns }; var result = (bool)_fileReader.InvokeStatic("HasSameNumberOfValues", parameterTypes, parameterValues); result.Should().BeFalse("Because columns does not have the same number of values."); }