Example #1
0
        public void CanNotGetAccount(string accountNumber, string name, decimal balance, AccountType type)
        {
            List <string> accountList = new List <string>();

            accountList.Add($"{accountNumber},{name},{balance},{type.ToString().Substring(0, 1).ToUpper()}");
            FileAccountRepository file = new FileAccountRepository();

            file.SaveToFile(accountList, @"C:\Test\FileTest.txt");

            Account accountExtract = file.GetAccount("00000", @"C:\Test\FileTest.txt");

            Assert.IsNull(accountExtract);
        }
Example #2
0
        public void CanGetAccount(string accountNumber, string name, decimal balance, AccountType type)
        {
            List <string> accountList = new List <string>();

            accountList.Add($"{accountNumber},{name},{balance},{type.ToString().Substring(0, 1).ToUpper()}");
            FileAccountRepository file = new FileAccountRepository();

            file.SaveToFile(accountList, @"C:\Test\FileTest.txt");

            Account accountToCheck = new Account()
            {
                AccountNumber = accountNumber, Name = name, Balance = balance, Type = type
            };
            Account accountExtract = file.GetAccount(accountNumber, @"C:\Test\FileTest.txt");

            Assert.AreEqual(accountToCheck.AccountNumber, accountExtract.AccountNumber);
        }