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 accountCategory = new AccountCategory
            {
                Name = "Other",
                Colour = "Orange",
                IsValid = true,
            };

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

            account1.setCategory(accountCategory);
            Assert.AreEqual(accountCategory.AccountCount(), 1);

            account2.setCategory(accountCategory);
            Assert.AreEqual(accountCategory.AccountCount(), 2);

            var accountCategory2 = new AccountCategory
            {
                Name = "New One",
                Colour = "Pink",
                IsValid = true,
            };

            account1.setCategory(accountCategory2);
            Assert.AreEqual(accountCategory.AccountCount(), 1);
            Assert.AreEqual(accountCategory2.AccountCount(), 1);
        }
Beispiel #2
0
        public void List_of_categories_updated_correctly()
        {
            AccountCategory accountCategory1 = new AccountCategory
            {
                Name = "Other",
                Colour = "Orange",
                IsValid = true,
            };
            AccountCategory accountCategory2 = new AccountCategory
            {
                Name = "Other2",
                Colour = "Blue",
                IsValid = true,
            };

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

            Assert.AreEqual(0, accountCategory1.AccountCount());
            Assert.AreEqual(0, accountCategory2.AccountCount());
            account.setCategory(accountCategory1);

            Assert.AreEqual(1, accountCategory1.AccountCount());
            Assert.AreEqual(0, accountCategory2.AccountCount());

            account.setCategory(accountCategory2);

            Assert.AreEqual(0, accountCategory1.AccountCount());
            Assert.AreEqual(1, accountCategory2.AccountCount());
        }