Exemplo n.º 1
0
    public static string Format(string currency, string locale, LedgerEntry[] entries)
    {
        var formatted = new StringBuilder();

        var ledgerCulture = _ledgerService.GetCulture(locale, currency);

        var translations = _ledgerService.GetTranslations(locale);

        formatted.Append(_ledgerPrinter.PrintHeader(translations));

        if (entries.Any())
        {
            var entriesForOutput = entries.GetOrderedEntries();

            foreach (var entry in entriesForOutput)
            {
                formatted.AppendNewLine(_ledgerPrinter.PrintEntry(ledgerCulture, LedgerConstants.TruncateLength, LedgerConstants.TruncateSuffix, entry));
            }
        }

        return(formatted.ToString());
    }