Esempio n. 1
0
        public void CanReadAccountsFromFile()
        {
            FileAccountRepository repo     = new FileAccountRepository(_testDataPath);
            List <Account>        accounts = repo.GetAccountsFromFile(_testDataPath);

            Assert.AreEqual(4, accounts.Count); // there should be 4 accounts in the repo
        }
Esempio n. 2
0
        public void CanEditFileAccount()
        {
            FileAccountRepository repo = new FileAccountRepository(_testDataPath);

            Account updatedAcct = new Account
            {
                AccountNumber = "11111",
                Name          = "Free Customer",
                Balance       = 1000m,
                Type          = AccountType.Free
            };

            repo.SaveAccount(updatedAcct);

            List <Account> updatedAccounts = repo.GetAccountsFromFile(_testDataPath);

            Account modifiedAcct = updatedAccounts.Single(a => a.AccountNumber == "11111");

            Assert.AreEqual(updatedAcct.Balance, modifiedAcct.Balance); //balance should be raised to 1000m
        }