public void shouldCheckForInvalidRange()
 {
     ExpenseRepository repository = new ExpenseRepository();
     ListExpenses request = new ListExpenses { From = DateTime.Today.Date, To = DateTime.Today.Date.AddDays(-1) };
     
     var interaction = new ListExpensesInteraction<RAMRepository.ExpenseRepository>(request, repository);
     interaction.performAction();
     var response = interaction.ResponseModel;
     Assert.IsTrue(response.Error.HasValue);
     Assert.AreEqual(Error.Codes.DATE_RANGE_INVALID, response.Error.Value.Code);
 }
        //
        // GET: /Expense/List
        public ActionResult List()
        {
            string fromString = Request.Params["from"];
            string toString = Request.Params["to"];
            DateTime from = fromString != null && fromString.Length > 2 ? DateTime.Parse(fromString) : DateTime.MinValue;
            DateTime to   = toString != null && toString.Length > 2 ? DateTime.Parse(toString) : DateTime.Today.Date;

            var requestModel = new Interactions.RequestModels.ListExpenses { From = from, To = to };
            var interaction = new ListExpensesInteraction(requestModel);
            interaction.performAction();
            if (interaction.ResponseModel.Error.HasValue)
            {
                return View("Index", "Home").Error(interaction.ResponseModel.Error.Value.Message);
            }
            else
            {
                return View(interaction.ResponseModel);
            }
        }
        public void shouldGetAllExpenses()
        {
            ExpenseRepository repository = new ExpenseRepository();
            ListExpenses request = new ListExpenses { From = DateTime.Today.Date, To = DateTime.Today.Date.AddDays(6) };
            
            var interaction = new ListExpensesInteraction<RAMRepository.ExpenseRepository>(request, repository);
            interaction.performAction();
            var response = interaction.ResponseModel;
            Assert.IsFalse(response.Error.HasValue);

            var expenses = response.Expenses.Select(x => new Expense() { Amount = x.Amount, Date = x.Date, Category = new Category() { Name = x.Category}, ExpenseId = x.ExpenseId }).ToList();

            Assert.AreEqual(expenses.Count, 6);
            Assert.IsTrue(expenses.Contains(gas0));
            Assert.IsTrue(expenses.Contains(gas1));
            Assert.IsTrue(expenses.Contains(food0));
            Assert.IsTrue(expenses.Contains(food1));
            Assert.IsTrue(expenses.Contains(gym0));
            Assert.IsTrue(expenses.Contains(gym1));
        }