Пример #1
0
        public void Create2CategoriesTest()
        {
            var account1 = _factory.CreateAccount("Account 1", "Description", "UAH", 5);
            var account2 = _factory.CreateAccount("Account 2", "Description 2", "USD", 5);

            _storage.CreateAccount(account1);
            _storage.CreateAccount(account2);

            var newAccount = _storage.GetAllAccounts().FirstOrDefault();

            Assert.IsNotNull(newAccount);
            Assert.AreEqual(1, _storage.GetAllAccounts().Count());
            Assert.AreEqual(account2.Name, newAccount.Name);
            Assert.AreEqual(account2.Description, newAccount.Description);
            Assert.AreEqual(5, newAccount.Id);
        }
Пример #2
0
        public void GetAllAccountsTest()
        {
            var factory = new RegularAccountFactory();
            var storage = new SqLiteAccountStorage(factory);

            _account.Description = DateTime.Now.ToShortTimeString();
            storage.CreateAccount(_account);

            var firstAccount = storage.GetAllAccounts().Last();

            Assert.AreEqual(_account.Name, firstAccount.Name);
            Assert.AreEqual(_account.Description, firstAccount.Description);
            Assert.AreEqual(_account.Currency, firstAccount.Currency);
        }
Пример #3
0
        public void DeleteAccountTest()
        {
            var factory = new RegularAccountFactory();
            var storage = new SqLiteAccountStorage(factory);

            storage.DeleteAllData();
            var account = CreateAccount();

            storage.CreateAccount(account);
            storage.DeleteAccount(account);


            var numberOfAccounts = storage.GetAllAccounts().Count();


            Assert.AreEqual(0, numberOfAccounts);
        }
Пример #4
0
        public void UpdateAccountTest()
        {
            var factory = new RegularAccountFactory();
            var storage = new SqLiteAccountStorage(factory);

            storage.DeleteAllData();
            var account = CreateAccount();

            storage.CreateAccount(account);
            account.Name        = "New Name";
            account.Description = "New Description";


            storage.UpdateAccount(account);


            var firstAccount = storage.GetAllAccounts().First();

            Assert.AreEqual(account.Name, firstAccount.Name);
            Assert.AreEqual(account.Description, firstAccount.Description);
        }