{"id":43208915,"url":"https://github.com/goodtocode/aspect-assertion","last_synced_at":"2026-02-01T07:13:06.769Z","repository":{"id":333417824,"uuid":"1136744937","full_name":"goodtocode/aspect-assertion","owner":"goodtocode","description":"Fluent Assertion aspect oriented library","archived":false,"fork":false,"pushed_at":"2026-01-19T09:19:47.000Z","size":55,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-19T13:41:25.547Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/goodtocode.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-18T09:18:05.000Z","updated_at":"2026-01-19T09:02:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/goodtocode/aspect-assertion","commit_stats":null,"previous_names":["goodtocode/aspect-assertion"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/goodtocode/aspect-assertion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-assertion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-assertion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-assertion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-assertion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goodtocode","download_url":"https://codeload.github.com/goodtocode/aspect-assertion/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goodtocode%2Faspect-assertion/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28971713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T06:46:42.625Z","status":"ssl_error","status_checked_at":"2026-02-01T06:44:56.173Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-02-01T07:13:05.895Z","updated_at":"2026-02-01T07:13:06.764Z","avatar_url":"https://github.com/goodtocode.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Goodtocode.Assertion\n\nFluent Assertion aspect-oriented library for .NET Standard 2.0+\n\n[![NuGet CI/CD](https://github.com/goodtocode/aspect-assertion/actions/workflows/gtc-assertion-nuget.yml/badge.svg)](https://github.com/goodtocode/aspect-assertion/actions/workflows/gtc-assertion-nuget.yml)\n\nGoodtocode.Assertion is a .NET library providing fluent assertion and validation utilities for C# projects. It enables developers to write expressive, readable, and maintainable assertions for business logic, unit tests, and runtime validation. The library is designed for extensibility and can be integrated into any .NET Standard 2.0+ project.\n\n## Features\n- Fluent assertion syntax for clear, readable code\n- Customizable assertion rules and exception handling\n- Assertion scopes for grouping related checks\n- Lightweight, dependency-free, and compatible with .NET Standard 2.0+\n- Designed for use in both production code and unit tests\n\n## Quick-Start Steps\n1. Clone this repository\n   ```\n   git clone https://github.com/goodtocode/aspect-assertion.git\n   ```\n2. Install .NET SDK (latest recommended)\n   ```\n   winget install Microsoft.DotNet.SDK --silent\n   ```\n3. Build the solution\n   ```\n   cd src\n   dotnet build Goodtocode.Assertion.sln\n   ```\n4. Run tests\n   ```\n   cd Goodtocode.Assertion.Tests\n   dotnet test\n   ```\n\n## Install Prerequisites\n- [.NET SDK (latest)](https://dotnet.microsoft.com/en-us/download)\n- Visual Studio (latest) or VS Code\n\n## Top Use Case Examples\n\n### 1. Basic Assertion Scope\n```csharp\nusing Goodtocode.Assertion;\n\nint value = 5;\nAssertionScope.Begin()\n\t.Assert(() =\u003e value \u003e 0, \"Value must be positive.\")\n\t.Assert(() =\u003e value \u003c 10, \"Value must be less than 10.\")\n\t.End();\n```\n\n### 2. Validating Object Properties\n```csharp\nusing Goodtocode.Assertion;\n\nvar user = new User { Name = \"Alice\", Age = 30 };\nAssertionScope.Begin()\n\t.Assert(() =\u003e !string.IsNullOrWhiteSpace(user.Name), \"Name is required.\")\n\t.Assert(() =\u003e user.Age \u003e= 18, \"User must be an adult.\")\n\t.End();\n```\n\n### 3. Custom Validator for Business Logic\n```csharp\nusing Goodtocode.Assertion;\n\npublic class GetMyUsersPaginatedQueryValidator : Validator\u003cGetMyUsersPaginatedQuery\u003e\n{\n\tpublic GetMyUsersPaginatedQueryValidator()\n\t{\n\t\tRuleFor(v =\u003e v.StartDate).NotEmpty()\n\t\t\t.When(v =\u003e v.EndDate != null)\n\t\t\t.LessThanOrEqualTo(v =\u003e v.EndDate);\n\n\t\tRuleFor(v =\u003e v.EndDate)\n\t\t\t.NotEmpty()\n\t\t\t.When(v =\u003e v.StartDate != null)\n\t\t\t.GreaterThanOrEqualTo(v =\u003e v.StartDate);\n\n\t\tRuleFor(x =\u003e x.PageNumber).NotEqual(0);\n\t\tRuleFor(x =\u003e x.PageSize).NotEqual(0);\n\t}\n}\n```\n\n### 4. Unit Test Assertion\n```csharp\nusing Goodtocode.Assertion;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\n[TestClass]\npublic class AssertionTests\n{\n\t[TestMethod]\n\tpublic void Should_Throw_When_Assertion_Fails()\n\t{\n\t\tAssert.ThrowsException\u003cAssertionFailedException\u003e(() =\u003e\n\t\t\tAssertionScope.Begin()\n\t\t\t\t.Assert(() =\u003e false, \"This should fail.\")\n\t\t\t\t.End());\n\t}\n}\n```\n\n## Technologies\n- [C# .NET](https://docs.microsoft.com/en-us/dotnet/csharp/)\n- [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/)\n\n## Version History\n\n\n| Version | Date        | Release Notes                                    |\n|---------|-------------|--------------------------------------------------|\n| 1.1.28  | 2026-Jan-20 | NuGet (semver) instead of file version.\t\t   |\n| 1.0.0   | 2026-Jan-19 | Initial release                                  |\n\n## License\n\nThis project is licensed with the [MIT license](https://mit-license.org/).\n\n## Contact\n- [GitHub Repo](https://github.com/goodtocode/aspect-assertion)\n- [@goodtocode](https://twitter.com/goodtocode)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodtocode%2Faspect-assertion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoodtocode%2Faspect-assertion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodtocode%2Faspect-assertion/lists"}