{"id":21243268,"url":"https://github.com/edrisym/e-wallet","last_synced_at":"2026-01-31T22:07:16.840Z","repository":{"id":262478124,"uuid":"887358524","full_name":"Edrisym/E-Wallet","owner":"Edrisym","description":"This E-Wallet project is developed using the Test-Driven Development (TDD) approach. It is built with .NET 8 and uses SQL Server for database management. The project utilizes XUnit for unit testing and FluentAssertions for expressive and readable assertions in tests.","archived":false,"fork":false,"pushed_at":"2024-12-07T19:56:48.000Z","size":139,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T17:36:17.223Z","etag":null,"topics":["csharp","digitalwallet","dotnet-core","dotnet8","e-wallet","e-wallet-system","ewallet","fluentassertions","multicurrency","multicurrency-wallet","sqlserver","test","unit-testing","wallet","xunit"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Edrisym.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-12T15:54:42.000Z","updated_at":"2024-12-07T19:56:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"ae9ec0be-2dd1-4f48-a76c-f6c0d83df835","html_url":"https://github.com/Edrisym/E-Wallet","commit_stats":null,"previous_names":["edrisym/e-wallet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Edrisym/E-Wallet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edrisym%2FE-Wallet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edrisym%2FE-Wallet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edrisym%2FE-Wallet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edrisym%2FE-Wallet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Edrisym","download_url":"https://codeload.github.com/Edrisym/E-Wallet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edrisym%2FE-Wallet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264652690,"owners_count":23644312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","digitalwallet","dotnet-core","dotnet8","e-wallet","e-wallet-system","ewallet","fluentassertions","multicurrency","multicurrency-wallet","sqlserver","test","unit-testing","wallet","xunit"],"created_at":"2024-11-21T01:11:23.861Z","updated_at":"2025-07-10T20:31:46.216Z","avatar_url":"https://github.com/Edrisym.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"### E-Wallet Project\n\n---\n\n## **Overview**\nThis E-Wallet project is developed using the **Test-Driven Development (TDD)** approach. It is built with **.NET 8** and uses **SQL Server** for database management. The project leverages **JWT (JSON Web Tokens)** for secure user authentication and authorization. The development is thoroughly tested using **XUnit** with enhanced readability provided by **FluentAssertions**. Core functionalities include wallet creation, balance management, withdrawal operations, and handling of multiple currencies.\n\n---\n\n## **Features**\n- **Wallet Creation**: Create a wallet with an initial balance.\n- **Withdrawals**: Withdraw funds from the wallet while ensuring sufficient balance.\n- **Currency Support**: Handle multiple currencies and exchange rates seamlessly.\n- **User Authentication**: Secure user authentication and authorization using **JWT**.\n- **TDD**: Adheres to the **Test-Driven Development (TDD)** approach, ensuring high code quality and comprehensive test coverage.\n- **SQL Server Integration**: Utilizes **SQL Server** as the primary database for data persistence.\n- **Custom Exceptions**: Provides tailored exception handling for scenarios like insufficient funds and invalid balances.\n\n---\n\n## **Technologies Used**\n- **C#**\n- **.NET 8**\n- **SQL Server**: Used for data storage and persistence.\n- **Entity Framework Core**: For database interactions and migrations.\n- **JWT (JSON Web Tokens)**: Secures authentication and authorization processes.\n- **XUnit**: Framework for unit testing.\n- **FluentAssertions**: Library for expressive and readable assertions in tests.\n\n---\n\n## **Project Structure**\n- **`Models`**: Contains classes representing business entities like `Wallet` and `Currency`.\n- **`Exceptions`**: Custom exceptions for specific error scenarios, such as insufficient funds.\n- **`Data`**: Contains database logic, including `DbContext` for Entity Framework.\n- **`Services`**: Implements core business logic for wallet operations.\n- **`Authentication`**: Includes JWT configuration and token generation.\n- **`Tests`**: Unit tests written with **XUnit** and **FluentAssertions**.\n\n---\n\n## **Setup and Installation**\n\n### **Prerequisites**\nTo run this project, ensure the following are installed:\n- **.NET 8 SDK**: [Download .NET 8](https://dotnet.microsoft.com/download/dotnet/8.0)\n- **SQL Server**: Local or cloud-based SQL Server instance.\n- **XUnit**: [XUnit](https://xunit.net/) for running unit tests.\n- **FluentAssertions**: [FluentAssertions](https://fluentassertions.com/) for enhanced test assertions.\n\n---\n\n### **Steps to Run the Project**\n\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/edrisym/e-wallet.git\n   cd e-wallet\n   ```\n\n2. **Restore Dependencies**:\n   Restore the required NuGet packages:\n   ```bash\n   dotnet restore\n   ```\n\n3. **Set Up SQL Server**:\n   Update the connection string in `appsettings.json`:\n   ```json\n   {\n     \"ConnectionStrings\": {\n       \"DefaultConnection\": \"Server=localhost;Database=EWalletDb;Trusted_Connection=True;\"\n     },\n     \"JwtSettings\": {\n       \"Issuer\": \"YourIssuerValue\",\n       \"Audience\": \"YourAudienceValue\",\n       \"Key\": \"YourSuperSecretKey12345\"\n     }\n   }\n   ```\n\n4. **Apply Migrations**:\n   Run migrations to set up the database schema:\n   ```bash\n   dotnet ef database update\n   ```\n\n5. **Build the Project**:\n   Compile the application:\n   ```bash\n   dotnet build\n   ```\n\n6. **Run the Tests**:\n   Execute all unit tests:\n   ```bash\n   dotnet test\n   ```\n\n7. **Run the Application**:\n   Launch the application:\n   ```bash\n   dotnet run\n   ```\n\n---\n\n## **Test-Driven Development (TDD) Approach**\nThis project strictly adheres to the **TDD** methodology:\n1. **Write Tests First**: Define the expected behavior with tests before implementation.\n2. **Implement Code**: Write only the code required to pass the test.\n3. **Refactor**: Improve the code structure while ensuring tests pass.\n\n---\n\n### **Example Test Case**\n\nHere’s an example test case for validating negative balances:\n\n```csharp\n[Fact]\npublic void Should_Throw_Exception_If_Balance_Is_Negative()\n{\n    var balance = -0.75m;\n    var currency = Currency.Create(\"USD\", \"United States Dollar\", 1.0m);\n    var walletCreation = () =\u003e Wallet.Create(balance, currency);\n\n    walletCreation.Should().ThrowExactly\u003cNegativeBalanceException\u003e();\n}\n```\n\nThis ensures the wallet creation logic enforces valid balance constraints.\n\n---\n\n## **JWT Authentication**\n\nThe project uses **JWT** for secure authentication and authorization:\n- **Issuer** and **Audience** validate the source and target of the token.\n- **Key** ensures the token's integrity.\n- **Token Validation**: Configured to ensure validity, expiration, and signature.\n\n---\n\n## **Contributing**\n\nContributions are welcome! Follow these steps to contribute:\n1. Fork the repository.\n2. Create a feature branch (`git checkout -b feature-branch`).\n3. Commit your changes (`git commit -am 'Add new feature'`).\n4. Push the branch (`git push origin feature-branch`).\n5. Submit a pull request.\n\nAll contributions should adhere to the **TDD** methodology and include corresponding unit tests.\n\n---\n\n## **License**\n\nThis project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for more details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedrisym%2Fe-wallet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedrisym%2Fe-wallet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedrisym%2Fe-wallet/lists"}