public void Account_count_returns_the_correct_result()
        {
            Account account1;
            Account account2;

            account1 = new Account
            {
                Name = "Bank Account",
                IsValid = true,
            };

            account2 = new Account
            {
                Name = "Bank Account",
                IsValid = true,
            };

            var accountType = new AccountType
            {
                Name = "Other",
                IsSource = true,
                IsDestination = true,
                IsValid = true,
            };

            Assert.AreEqual(accountType.AccountCount(), 0);

            account1.setType(accountType);
            Assert.AreEqual(accountType.AccountCount(), 1);

            account2.setType(accountType);
            Assert.AreEqual(accountType.AccountCount(), 2);

            var accountType2 = new AccountType
            {
                Name = "New One",
                IsSource = true,
                IsDestination = true,
                IsValid = true,
            };

            account1.setType(accountType2);

            Assert.AreEqual(accountType.AccountCount(), 1);
            Assert.AreEqual(accountType2.AccountCount(), 1);
        }
Beispiel #2
0
        public void List_of_types_updated_correctly()
        {
            AccountType accountType1 = new AccountType
            {
                Name = "Asset",
                IsDestination = true,
                IsSource = true,
                IsValid = true,
            };
            AccountType accountType2 = new AccountType
            {
                Name = "Expense",
                IsDestination = true,
                IsSource = true,
                IsValid = true,
            };

            var account = new Account
            {
                IsValid = true,
                Name = "Test Account",
            };

            Assert.AreEqual(0, accountType1.AccountCount());
            Assert.AreEqual(0, accountType2.AccountCount());
            account.setType(accountType1);

            Assert.AreEqual(1, accountType1.AccountCount());
            Assert.AreEqual(0, accountType2.AccountCount());

            account.setType(accountType2);

            Assert.AreEqual(0, accountType1.AccountCount());
            Assert.AreEqual(1, accountType2.AccountCount());
        }