Testing - Learnathon-By-Geeky-Solutions/binary-brains GitHub Wiki

🧪 Testing – AmarTech E-Commerce System

Testing is a core part of AmarTech’s development process. The solution includes a dedicated test project: AmarTech.Test, structured to ensure each layer of the application is well-tested and reliable.


📁 Test Project Structure

The AmarTech.Test project includes unit and integration tests across different layers:

  • ControllerTests – Validates controller logic and HTTP responses.
  • RepositoryTests – Tests data access methods and edge cases.
  • ServiceTests – Ensures business logic in service classes behaves correctly.
  • DBInitializerTest – Verifies that the initial data seeding is working as expected.
  • GenericRepositoryTests – Tests generic repository methods for correctness and flexibility.
  • ManageNavPageTests – Tests navigation logic and visibility rules in UI-specific scenarios.

🧰 Testing Frameworks Used

  • xUnit – The primary testing framework used for all unit tests.
  • Moq – Used for mocking dependencies such as services, repositories, and database context to isolate test targets.

🚫 Exclusions

  • Program.cs is not tested, as .NET Core currently doesn’t support direct unit testing for it and it mainly contains framework-level setup code.

✅ Code Coverage

  • The test suite currently covers more than 90% of the entire project’s codebase, ensuring high reliability and maintainability.

📊 SonarCloud Coverage Report

We use SonarCloud to track code quality and test coverage.
Click below to view the full report: Code Coverage