Exemplo n.º 1
0
        public void GetAllCategories_ReadTestData_CorrectValuesReturned()
        {
            var result = Cash.GetAllCategories(_testDataTable, Functions.GetDate("28.02.1982"));

            Assert.That(result[0].Categorytotal, Is.EqualTo("Getränke: 50 EUR"));
            Assert.That(result[1].Categorytotal, Is.EqualTo("Kino: 10 EUR"));
            Assert.That(result[2].Categorytotal, Is.EqualTo("Lebensmittel: 200 EUR"));
            Assert.That(result[3].Categorytotal, Is.EqualTo("Miete: 1400 EUR"));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                var readValues = Functions.GetInputValues(args);
                switch (readValues.Type)
                {
                case Types.TypeOutpayment:
                {
                    Payment.CreateNewRecord(Types.BookingTypeEnum.Outbound, readValues.Date, readValues.Amount,
                                            readValues.Category, readValues.Memo);
                    Payment.SaveRecord();
                    var table        = Payment.ReadAllRecords();
                    var totalCash    = Cash.GetCashAmount(table, readValues.Date);
                    var categoryCash = Cash.GetCategoryAmount(table, readValues.Category, readValues.Date);
                    var vm           = new ViewModel.ViewModel(totalCash, categoryCash, readValues.Category);
                    vm.PrintCashTotal();
                    vm.PrintCategoryTotal();
                    break;
                }

                case Types.TypePayment:
                {
                    Payment.CreateNewRecord(Types.BookingTypeEnum.Inbound, readValues.Date, readValues.Amount);
                    Payment.SaveRecord();
                    var table     = Payment.ReadAllRecords();
                    var totalCash = Cash.GetCashAmount(table, readValues.Date);
                    var vm        = new ViewModel.ViewModel(totalCash);
                    vm.PrintCashTotal();
                    break;
                }

                case Types.TypeOverview:
                {
                    var table     = Payment.ReadAllRecords();
                    var totalCash = Cash.GetCashAmount(table, readValues.Date);
                    var vm        = new ViewModel.ViewModel(totalCash);
                    vm.PrintCashTotal();
                    var categories = Cash.GetAllCategories(table, readValues.Date);
                    foreach (var model in categories)
                    {
                        model.PrintCategoryTotal();
                    }
                    break;
                }
                }
            }
        }
Exemplo n.º 3
0
        public void GetAllCategories_ReadTestData_CorrectNumberReturned()
        {
            var result = Cash.GetAllCategories(_testDataTable, Functions.GetDate("28.02.1982"));

            Assert.That(result.Count, Is.EqualTo(4));
        }