Esempio n. 1
0
        public void CanSaveToFile(string accountNumber, string name, decimal balance, AccountType type, bool expected)
        {
            List <string> accountList = new List <string>();

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

            FileAccountRepository file = new FileAccountRepository();

            Assert.AreEqual(expected, file.SaveToFile(accountList, @"C:\Test\FileTest.txt"));
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public void CanListAccount(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 = "00000", Name = name, Balance = balance, Type = type
            };
            List <string> accountExtract = file.ListAccount(accountToCheck, @"C:\Test\FileTest.txt");

            Assert.AreEqual(accountList[0], accountExtract[0]);
        }