This project is a demonstration of a Bank Application developed using Clean Architecture principles. The application is designed with a focus on Test-Driven Development (TDD) and includes multiple test projects to ensure high code quality and reliability. The project also utilizes modern development practices such as Dependency Injection, Entity Framework Core, and Middleware for error handling.
The Bank Application allows users to:
- Create bank accounts.
- Deposit money into accounts.
- Withdraw money from accounts.
This application demonstrates a scalable architecture and best practices for building robust APIs.
- .NET 8: Backend framework.
- Entity Framework Core: Database ORM.
- xUnit: Unit testing framework.
- FluentAssertions: For more readable test assertions.
- SQLite: Lightweight database for development and testing.
- GitHub Actions: Continuous Integration and Deployment (CI/CD).
└── imansafari1991-bank/
├── Bank.sln # Solution file
└── src/
├── code/
│ ├── Bank.API/ # API project
│ ├── Bank.Business/ # Business logic layer
│ ├── Bank.Domain/ # Domain layer (Entities and Constants)
│ └── Bank.Persistence/# Persistence layer (EF Core)
└── test/
├── Bank.API.Tests/ # API Integration Tests
├── Bank.Business.Tests.Unit/ # Business Logic Unit Tests
├── Bank.Domain.Tests.Unit/ # Domain Logic Unit Tests
├── Bank.Integration.Tests/ # Full Integration Tests
└── Bank.Persistence.Tests.Integration/ # Database Tests
Ensure you have the following installed:
- Clone the repository:
git clone https://github.com/imansafari1991/imansafari1991-bank.git cd imansafari1991-bank - Navigate to the API project:
cd src/code/Bank.API - Restore dependencies:
dotnet restore
- Run the application:
dotnet run
- The API will be available at
http://localhost:5000(or as defined in thelaunchSettings.json).
Use the provided Bank.API.http file to test API endpoints via tools like Visual Studio Code REST Client or Postman.
This project follows Test-Driven Development (TDD) principles. The tests are divided into:
- Unit Tests: Focus on isolated components (e.g.,
BankAccountServiceTests). - Integration Tests: Verify interactions between multiple components (e.g.,
BankAccountControllerTests). - API Tests: Test the API endpoints.
From the root of the solution, run:
dotnet testNavigate to the desired test project and execute:
cd test/Bank.Business.Tests.Unit
dotnet test- Implement CI/CD Pipeline: Automate build, test, and deployment using GitHub Actions.
- Add Swagger: Provide an interactive API documentation.
- Containerization: Use Docker to containerize the application for easier deployment.
- Enhanced Error Handling: Improve the middleware to support custom error codes and logging.
If you have any questions or suggestions, feel free to open an issue or create a pull request!
Author: Iman Safari