public IActionResult Expenses() { List <Expense> txns = new List <Expense>(); txns = _repo.GetExpenses().ToList(); var result = txns; _logger.LogInformation(200, "Expenses request complete"); return(Ok(result)); }
public void Expenses_OnExecute_ReturnExpenses() { //Arrange ExpensesController controller = new ExpensesController(_repo, _logger); //Act var inputDataSource = controller.Expenses(); var requestResult = inputDataSource as OkObjectResult; List <Expense> txnList = (List <Expense>)requestResult.Value; //Assert Assert.AreEqual(2, txnList.Count); CollectionAssert.AreEqual(_repo.GetExpenses().ToList(), txnList, new ExpenseComparer()); }