Beispiel #1
0
        public void ShouldSetViewCaption()
        {
            var expenseItem = CreateExpenseItem();
            var expense     = new MonthlyCashStatement(expenseItem, month(1), 02.02.of2009(), 10, "expense item");

            Run(expense);

            Assert.AreEqual("Изменить трату по статье", view.Text);
        }
        public void DeleteMonthlyExpenses()
        {
            ArrangeWeeks(02.02.of2009());
            var expenseItem = new MonthlyCashStatementCategory(1, 1, "Gaz");
            var expense1    = new MonthlyCashStatement(expenseItem, month(2), 03.02.of2009(), 10, "1");
            var expense2    = new MonthlyCashStatement(expenseItem, month(2), 03.02.of2009(), 20, "2");

            budget.MonthlyCashMovements = new[] { expense1, expense2 };

            ExpectDeletion(x => x.DeleteMonthlyCashMovement(expense1));
            //

            Run();

            view.CalculationResultsFake.DataSource.ElementAt(2).Delete();
        }
Beispiel #3
0
        public void ShouldDisplayDataOfMonthlyExpenseBeingEdited()
        {
            var expenseItem = CreateExpenseItem();
            var expense     = new MonthlyCashStatement(expenseItem, month(1), 02.02.of2009(), 10, "expense item")
            {
                IsFinalPayment = true
            };

            Run(expense);
            //

            AreEqual(expenseItem, view.Expense.ExpenseItem.ExpenseItem);
            AreEqual(01.01.of2009(), view.Expense.Month);
            AreEqual(02.02.of2009(), view.Expense.Date);
            AreEqual(-10, view.Expense.Amount);
            AreEqual("expense item", view.Expense.Description);
            AreEqual(true, view.Expense.IsFinal);
        }
        public void Run(MonthlyCashStatement expense)
        {
            this.expense = expense;

            peExpense = new PEMonthlyExpense {
                ExpenseItem  = new PESelectableExpenseItem(expense.Category),
                ExpenseItems = PESelectableExpenseItem.CreateListFrom(dataProvider),
                Month        = expense.Month.GetDate(1),
                Date         = expense.Date,
                Amount       = expense.Amount.NegateIf(expense.Category.IsNegative),
                Description  = expense.Description,
                IsFinal      = expense.IsFinalPayment,
            };

            view.Text    = "Изменить трату по статье";
            view.Expense = peExpense;
            view.OnOK    = OnExpenseEdited;
            view.Show();
        }
Beispiel #5
0
        private void Run(MonthlyCashStatement expense)
        {
            var useCase = new EditMonthlyExpenseUseCase(dataProvider, dataSavingServiceMock.Object, view);

            useCase.Run(expense);
        }
Beispiel #6
0
 private static string DescriptionOf(MonthlyCashStatement expense)
 {
     return(expense.Description == ""
                         ? expense.Category.Name
                         : string.Format("{0} : {1}", expense.Category.Name, expense.Description));
 }
Beispiel #7
0
 private void OnEditMonthlyExpense(MonthlyCashStatement expense)
 {
     ObjectFactory.GetInstance <IEditMonthlyExpenseUseCase>().Run(expense);
 }
Beispiel #8
0
 private void OnEditExpenseItem(MonthlyCashStatement expense)
 {
     ObjectFactory.GetInstance <IEditExpenseItemUseCase>().Run(expense.Category);
 }
 public void DeleteMonthlyCashMovement(MonthlyCashStatement movement)
 {
     Delete(data.MonthlyCashMovements, movement);
 }