예제 #1
0
        public async Task ApplicationService_GetMostSpentCategory_IsValid()
        {
            var mostSpentCategory = await _applicationService.GetMostSpentCategory();

            var expectedCategory = new KeyValuePair <string, double>("Escola", 14);

            Assert.AreEqual(mostSpentCategory, expectedCategory);
        }
예제 #2
0
        /// <summary>
        /// Informa qual categoria cliente gastou mais;
        /// </summary>
        public static async Task PrintMostSpentCategory(this TransactionApplicationService clientService)
        {
            var category = await clientService.GetMostSpentCategory();

            if (!string.IsNullOrEmpty(category.Key))
            {
                Console.WriteLine(
                    $"A Categoria que você mais gastou foi {category.Key}. Nesta categoria, você gastou um total de R$ {category.Value:N}");
            }
        }