コード例 #1
0
        public void CanGetAListOfAccounts()
        {
            DataHelper.NewDb();

            var service = new RentalsService();

            Assert.AreEqual(DataHelper.Accounts.Count, service.GetAllAccounts().Count);
        }
コード例 #2
0
        public void CanGetAnEmptyListOfAccounts()
        {
            DataHelper.NewDb(false);

            var service = new RentalsService();

            Assert.AreEqual(0, service.GetAllAccounts().Count);
        }
コード例 #3
0
        public void GetAllAccountsIncludesBalances()
        {
            DataHelper.NewDb();

            var service = new RentalsService();
            var actual  = new List <Account>(service.GetAllAccounts());

            Assert.AreEqual(DataHelper.Accounts.Count, actual.Count);
            Assert.AreEqual(DataHelper.GetAccountBalance(1), actual[0].Balance);
            Assert.AreEqual(DataHelper.GetAccountBalance(2), actual[1].Balance);
            Assert.AreEqual(DataHelper.GetAccountBalance(3), actual[2].Balance);
        }
コード例 #4
0
        public void CanInsertNewAccount()
        {
            DataHelper.NewDb();

            var accountToAdd = new Account()
            {
                Name           = "BankAccount4",
                OpeningBalance = 100.99m
            };

            var service = new RentalsService();

            service.SaveNewAccount(accountToAdd);
            Assert.AreEqual(DataHelper.Accounts.Count + 1, service.GetAllAccounts().Count);
        }