A C# console application that simulates an ATM (Automated Teller Machine) system with both customer and administrative functionalities.
-
Customer Operations:
- Account login with PIN
- Check balance
- Withdraw money
- Deposit money
- Exit
-
Administrative Operations:
- Create new accounts
- Delete existing accounts
- Update account information
- Search for accounts
- Exit
- .NET 8.0 SDK or later
- MySQL Server 8.0 or later
- Visual Studio 2022 or Visual Studio Code with C# extensions
-
Clone the Repository
git clone [repository-url] cd ATMSystem -
Database Setup
- Install MySQL Server if not already installed
- Open MySQL command line or MySQL Workbench
- Run the database script:
mysql -u root -p < database/atm_database.sql
-
Configure Connection String
- Open
src/ATMSystem/appsettings.json - Update the connection string with your MySQL credentials:
{ "ConnectionStrings": { "DefaultConnection": "Server=localhost;Database=atm_system;User=your_username;Password=your_password;" } }
- Open
-
Build the Project
dotnet build
-
Run the Main Application
cd src/ATMSystem dotnet run -
Default Admin Account
- Login: Javed123
- PIN: 12345
-
Default Customer Account
- Login: Adnan123
- PIN: 12345
-
Run All Tests
dotnet test -
Run Tests with Coverage
dotnet test --collect:"XPlat Code Coverage"
Coverage reports will be generated in the
coveragedirectory.
Models/: Contains the domain models (Account, etc.)Services/: Contains business logic (AccountService, etc.)Repositories/: Contains data access logic (MySqlAccountRepository, etc.)Tests/: Contains unit tests
- Create appropriate models in the
Modelsdirectory - Add business logic in the
Servicesdirectory - Implement data access in the
Repositoriesdirectory - Write unit tests in the
Testsdirectory
The project uses StyleCop for code style enforcement. Make sure to follow the established coding standards:
- Use XML documentation comments for public members
- Follow C# naming conventions
- Keep methods focused and small
- Write unit tests for new features
The project uses DocFX for API documentation. To generate documentation:
-
Install DocFX:
dotnet tool install -g docfx
-
Generate documentation:
docfx build
-
View documentation locally:
docfx serve _site
The database consists of a single table:
CREATE TABLE accounts (
account_number INT AUTO_INCREMENT PRIMARY KEY,
holder_name VARCHAR(255) NOT NULL,
balance DECIMAL(15, 2) NOT NULL DEFAULT 0.00,
status VARCHAR(50) NOT NULL,
login VARCHAR(50) NOT NULL UNIQUE,
pin_code VARCHAR(5) NOT NULL
);-
Database Connection Issues
- Verify MySQL service is running
- Check connection string in appsettings.json
- Ensure database and user permissions are correct
-
Build Errors
- Ensure .NET 8.0 SDK is installed
- Run
dotnet restoreto restore packages - Check for any missing dependencies
-
Test Failures
- Check database connection
- Verify test data setup
- Check for any environment-specific issues
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request