-- Use the FinanceManagement database
USE FinanceManagement;
-- =====================
-- TESTING USER ACCOUNTS
-- =====================
-- Test: Add Accounts
CALL AddAccount(1, 'Alice\'s Checking Account');
CALL AddAccount(1, 'Alice\'s Savings Account');
CALL AddAccount(2, 'Bob\'s Personal Account');
CALL AddAccount(3, 'Charlie\'s Checking Account');
-- =====================
-- TESTING CATEGORIES
-- =====================
-- Test: Add Categories
CALL AddCategory(1, 'Groceries');
CALL AddCategory(1, 'Utilities');
CALL AddCategory(2, 'Transport');
CALL AddCategory(2, 'Entertainment');
CALL AddCategory(3, 'Health & Fitness');
-- =====================
-- TESTING TRANSACTIONS
-- =====================
-- Test: Add Transactions
CALL AddTransaction(1, 1, 120.00, 'Weekly grocery shopping', CURDATE() - INTERVAL 3
DAY);
CALL AddTransaction(2, 4, 15.00, 'Bus fare to work', CURDATE() - INTERVAL 7 DAY);
CALL AddTransaction(3, 7, 900.00, 'Monthly rent payment', CURDATE() - INTERVAL 1
DAY);
-- =====================
-- TESTING FINANCIAL SUMMARY
-- =====================
-- Test: Get Financial Summary for Alice (user_id = 1)
CALL GetFinancialSummary(1, 'weekly');
CALL GetFinancialSummary(1, 'monthly');
CALL GetFinancialSummary(1, 'yearly');
-- Test: Get Financial Summary for Bob (user_id = 2)
CALL GetFinancialSummary(2, 'weekly');
CALL GetFinancialSummary(2, 'monthly');
CALL GetFinancialSummary(2, 'yearly');
-- =====================
-- TESTING TRANSACTIONS BY ACCOUNT
-- =====================
-- Test: Get Transactions by Account for Alice's Checking Account (account_id = 1)
CALL GetTransactionsByAccount(1);
-- Test: Get Transactions by Account for Bob's Personal Account (account_id = 2)
CALL GetTransactionsByAccount(2);