public void FormatTest_WithSingleFieldAtaTime(string formatVariant) { var formatter = new EntityFormatter(typeof(POCOMultiTypeObject)); var data = new POCOMultiTypeObject(); foreach (string fieldName in TestSupport.TestSQLConstants.MULTI_PROP_TABLE_FIELDS .Except(TestSupport.TestSQLConstants.NON_REFLECTED_MULTI_PROP_TABLE_FIELDS)) { var formatString = "[" + fieldName + formatVariant + "]"; Output.WriteLine(formatString); var formatedString = formatter.Format(formatString, data, null); Assert.NotNull(formatString); Assert.NotEmpty(formatString); Assert.NotEqual(formatString, formatedString); Output.WriteLine(formatedString); } }
public void FormatTest_WithAllFieldsAtOnce(string formatVariant) { var formatter = new EntityFormatter(typeof(POCOMultiTypeObject)); var data = new POCOMultiTypeObject(); var formatString = String.Join(",", (from string field in TestSupport.TestSQLConstants.MULTI_PROP_TABLE_FIELDS .Except(TestSupport.TestSQLConstants.NON_REFLECTED_MULTI_PROP_TABLE_FIELDS) select "[" + field + formatVariant + "]")); Output.WriteLine(formatString); var formatedString = formatter.Format(formatString, data, null); Assert.NotNull(formatString); Assert.NotEmpty(formatString); Assert.NotEqual(formatString, formatedString); Output.WriteLine(formatedString); }
public void FormatTest_WithAllFieldsAtOnce(string formatVariant) { var ed = new EntityDescription(typeof(DOMultiPropType)); var formatter = new EntityFormatter(ed); var data = new DOMultiPropType(); var formatString = String.Join(",", (from string field in TestSupport.TestSQLConstants.MULTI_PROP_TABLE_FIELDS .Except(TestSupport.TestSQLConstants.NON_REFLECTED_MULTI_PROP_TABLE_FIELDS) select "[" + field + formatVariant + "]")); _output.WriteLine(formatString); var formatedString = formatter.Format(formatString, data, null); Assert.NotNull(formatString); Assert.NotEmpty(formatString); Assert.NotEqual(formatString, formatedString); _output.WriteLine(formatedString); }
public void FormatTest_WithSingleFieldAtaTime(string formatVariant) { var ed = new EntityDescription(typeof(DOMultiPropType)); var formatter = new EntityFormatter(ed); var data = new DOMultiPropType(); foreach (string fieldName in TestSupport.TestSQLConstants.MULTI_PROP_TABLE_FIELDS .Except(TestSupport.TestSQLConstants.NON_REFLECTED_MULTI_PROP_TABLE_FIELDS)) { var formatString = "[" + fieldName + formatVariant + "]"; _output.WriteLine(formatString); var formatedString = formatter.Format(formatString, data, null); Assert.NotNull(formatString); Assert.NotEmpty(formatString); Assert.NotEqual(formatString, formatedString); _output.WriteLine(formatedString); } }
/// <summary> /// replaces placeholders with property values in format string. /// [propertyName], [propertyName:nullValue], [propertyName:nullValue:pad], [propertyName::pad] /// pad option can include prefix U | L | C . for Uppercase, lowercase, capitalize /// </summary> public string ToString(string format, IFormatProvider formatProvider) { ICustomFormatter formatter; var description = DatastoreRedux.LookUpEntityByType(this.GetType()); formatter = new EntityFormatter(description); if (formatter != null) { return formatter.Format(format, this, formatProvider); } else { return base.ToString(); } }