Esempio n. 1
0
        public async Task TestGetExpensesByUserIdAsync()
        {
            var dbContext  = DbContextMocker.GetExpenseManagerDbContext(nameof(TestGetExpensesByUserIdAsync));
            var controller = new ExpensesController(dbContext);

            var response = await controller.GetExpenseByUser(1, "");

            var value = response.Value;

            dbContext.Dispose();

            // Assert
            Assert.IsType <ActionResult <IEnumerable <Expense> > >(response);
            Assert.IsType <List <Expense> >(value);
            Assert.Equal(2, (value as List <Expense>).Count);
        }