public void CanInsertNewTransactionWithANewAccountCategoryAndPayeeAndAllWillBeInserted() { DataHelper.NewDb(); var service = new RentalsService(); var transactionToAdd = new Transaction() { Date = DateTime.Today, Amount = 10.00m, Account = new Account() { Name = "New Accoount", OpeningBalance = 0.00m }, Payee = new Payee() { Name = "New Payee", DefaultCategoryId = 1 }, Category = new Category() { Name = "New Category", Type = CategoryType.Income }, Reference = "Reference", Memo = "Memo" }; service.SaveNewTransaction(transactionToAdd); Assert.AreEqual(DataHelper.Transactions.Count + 1, service.GetNumberOfTransactions()); Assert.AreEqual(DataHelper.Accounts.Count + 1, service.GetNumberOfAccounts()); Assert.AreEqual(DataHelper.Payees.Count + 1, service.GetNumberOfPayees()); Assert.AreEqual(DataHelper.Categories.Count + 1, service.GetNumberOfCategories()); }
public void CanGetNumberOfTransactions() { DataHelper.NewDb(); var service = new RentalsService(); Assert.AreEqual(DataHelper.Transactions.Count, service.GetNumberOfTransactions()); }
public void CanInsertNewTransactionWithAllMandatoryDataPresent() { DataHelper.NewDb(); var service = new RentalsService(); var transactionToAdd = new Transaction() { Date = DateTime.Today, Amount = 10.00m, AccountId = 1, PayeeId = 1, CategoryId = 1 }; service.SaveNewTransaction(transactionToAdd); Assert.AreEqual(DataHelper.Transactions.Count + 1, service.GetNumberOfTransactions()); }