Beispiel #1
0
        public void InitialValuesFillingTest()
        {
            var viewModel = new EditChildTransactionViewModel(_storages, _transaction, _childTransaction);

            Assert.AreEqual(_transaction.Account, viewModel.Account);
            Assert.AreEqual(_transaction.Timestamp, viewModel.Timestamp);
            Assert.AreEqual(String.Empty, viewModel.ErrorString);
        }
Beispiel #2
0
        public void UpdateChildTransactionNewTest()
        {
            var viewModel = new EditChildTransactionViewModel(_storages, _transaction, null);

            viewModel.UpdateChildTransaction();

            Assert.IsTrue(false);
        }
Beispiel #3
0
        public void ConstructorWithNoParentTransactionTest()
        {
            var viewModel = new EditChildTransactionViewModel(_storages, null, null);


            Assert.IsNull(viewModel.Account);
            Assert.IsNull(viewModel.Category);
            Assert.IsNotNull(viewModel.Accounts);
            Assert.IsNotNull(viewModel.Categories);
            Assert.AreEqual(DateTime.Today, viewModel.Timestamp.Date);
        }
Beispiel #4
0
        public EditChildTransaction(ITransaction parent, IAccount activeAccount, ITransaction transaction = null)
        {
            this.InitializeComponent();

            if (transaction == null)
            {
                InitCreateMode();
            }
            else
            {
                InitUpdateMode();
            }
            ViewModel = new EditChildTransactionViewModel(MainPage.GlobalSettings.Storages, parent, transaction);
        }
Beispiel #5
0
        public void CreateChildTransactionNewTest()
        {
            var viewModel = new EditChildTransactionViewModel(_storages, _transaction, null)
            {
                Category = _category
            };

            viewModel.CreateChildTransaction();

            Assert.AreEqual(_transaction.Account, viewModel.Account);
            Assert.IsNotNull(viewModel.Category);
            Assert.IsNotNull(viewModel.Accounts);
            Assert.IsNotNull(viewModel.Categories);
        }
Beispiel #6
0
        public void UpdateChildTransactionTest()
        {
            var viewModel = new EditChildTransactionViewModel(_storages, _transaction, _childTransaction)
            {
                Category = _childCategory,
                Name     = "Child Transaction",
                Total    = 22.17m,
                Weight   = 0.917m
            };

            viewModel.UpdateChildTransaction();

            var savedTransaction = _storages.TransactionStorage.GetAllTransactions().FirstOrDefault(x => x.Id == _childTransaction.Id);

            Assert.IsNotNull(savedTransaction);
            Assert.AreEqual(_transaction.Account, savedTransaction.Account);
            Assert.AreEqual(0.917m, savedTransaction.Weight);
            Assert.AreEqual(22.17m, savedTransaction.Total);
            Assert.AreEqual(_childCategory, savedTransaction.Category);
        }