// calculates the alignment to use private AsciiTableAlignment calculateAlignment(Type columnType) { FormatSettings <object> formatSettings = formatSettingsProvider.settings(columnType, defaultSettings); bool isNumeric = formatSettings.Category == FormatCategory.NUMERIC || formatSettings.Category == FormatCategory.DATE; return(isNumeric ? AsciiTableAlignment.RIGHT : AsciiTableAlignment.LEFT); }
public virtual void doubleArray() { FormatSettingsProvider settingsProvider = FormatSettingsProvider.INSTANCE; FormatSettings <object> defaultSettings = FormatSettings.of(FormatCategory.TEXT, ValueFormatters.UNSUPPORTED); FormatSettings <double[]> settings = settingsProvider.settings(typeof(double[]), defaultSettings); ValueFormatter <double[]> formatter = settings.Formatter; double[] array = new double[] { 1, 2, 3 }; assertThat(formatter.formatForDisplay(array)).isEqualTo("[1.0, 2.0, 3.0]"); assertThat(formatter.formatForCsv(array)).isEqualTo("[1.0 2.0 3.0]"); }