Exemple #1
0
        public async Task ApplicationService_GetSpentValuesByCategory_IsValid()
        {
            var categories = await _applicationService.GetSpentValuesByCategoryOrdered();

            var expected = new Dictionary <string, double>
            {
                { "Escola", 14 },
                { "Animal", 13 }
            };

            //Checa se ambas as categorias serão iguais.
            CollectionAssert.AreEqual(expected, categories);
        }
Exemple #2
0
        /// <summary>
        /// Exibe o total de gastos por categoria;
        /// </summary>
        public static async Task PrintSpentValuesByCategory(this TransactionApplicationService transactionService)
        {
            ConsoleHelper.WriteHeader("Total gasto por Categoria");
            var categories = await transactionService.GetSpentValuesByCategoryOrdered();

            if (categories.Count > 0)
            {
                ConsoleHelper.PrintRow("Categoria", "Total Gasto");
                categories.ToList().ForEach(c => ConsoleHelper.PrintRow(c.Key, c.Value.ToString("N")));
            }
            else
            {
                Console.WriteLine("Não há categorias.");
            }

            Console.WriteLine();
        }