Esempio n. 1
0
        public void SourceUpdatedIfItemMovedLazily()
        {
            Account account1;
            Account account2;

            account1 = new Account
            {
                Name = "Bank Account",
                IsValid = true,
            };
            account1.setType(_accountType1);
            account1.setCategory(_accountCategory);

            account2 = new Account
            {
                Name = "Food",
                IsValid = true,
            };
            account2.setType(_accountType2);
            account2.setCategory(_accountCategory);

            var item = new Item
            {
                Value = 99.99M,
                Description = "Move Test",
                IsVerified = true,
            };

            item.SetSourceLazy(account2);
            Assert.AreEqual(item.Source, account2);
            Assert.AreNotEqual(item.Source, account1);

            item.SetSourceLazy(account1);
            Assert.AreEqual(item.Source, account1);
            Assert.AreNotEqual(item.Source, account2);
        }
Esempio n. 2
0
 public void Cannot_move_money_from_destination_only_account_lazily()
 {
     var item = new Item
     {
         Value = 99.01M,
         Description = "Add Test",
         IsVerified = true,
     };
     item.SetTransaction(_transaction1);
     item.SetSourceLazy(_account3);
     item.SetDestinationLazy(_account1);
 }
Esempio n. 3
0
 public void Cannot_move_money_within_the_same_account_lazily()
 {
     var item = new Item
     {
         Value = 567.78M,
         Description = "Add Test",
         IsVerified = true,
     };
     item.SetTransaction(_transaction1);
     item.SetSourceLazy(_account1);
     item.SetDestinationLazy(_account1);
 }