{"id":23081195,"url":"https://github.com/kasthack-labs/kasthack.notempty","last_synced_at":"2025-08-27T07:16:29.342Z","repository":{"id":65545277,"uuid":"437544938","full_name":"kasthack-labs/kasthack.NotEmpty","owner":"kasthack-labs","description":".NotEmpty\u003cT\u003e() test extension","archived":false,"fork":false,"pushed_at":"2023-01-08T04:52:50.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-18T12:00:52.495Z","etag":null,"topics":["emptiness","nullability","nunit","test","testing","xunit"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kasthack-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":"kasthack","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-12-12T12:53:41.000Z","updated_at":"2022-01-06T13:15:17.000Z","dependencies_parsed_at":"2023-02-08T04:46:33.895Z","dependency_job_id":null,"html_url":"https://github.com/kasthack-labs/kasthack.NotEmpty","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":"kasthack-labs/dotnet-repo-template","purl":"pkg:github/kasthack-labs/kasthack.NotEmpty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasthack-labs%2Fkasthack.NotEmpty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasthack-labs%2Fkasthack.NotEmpty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasthack-labs%2Fkasthack.NotEmpty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasthack-labs%2Fkasthack.NotEmpty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kasthack-labs","download_url":"https://codeload.github.com/kasthack-labs/kasthack.NotEmpty/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasthack-labs%2Fkasthack.NotEmpty/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272303306,"owners_count":24910355,"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","status":"online","status_checked_at":"2025-08-27T02:00:09.397Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["emptiness","nullability","nunit","test","testing","xunit"],"created_at":"2024-12-16T13:49:27.479Z","updated_at":"2025-08-27T07:16:29.325Z","avatar_url":"https://github.com/kasthack-labs.png","language":"C#","funding_links":["https://patreon.com/kasthack"],"categories":[],"sub_categories":[],"readme":"# kasthack.NotEmpty\n\n\n[![NuGet](https://img.shields.io/nuget/dt/kasthack.NotEmpty.Core.svg)](https://nuget.org/packages/kasthack.NotEmpty.Core)\n[![GitHub release](https://img.shields.io/github/release/kasthack-labs/kasthack.NotEmpty.svg)](https://github.com/kasthack-labs/kasthack.NotEmpty/releases/latest)\n[![license](https://img.shields.io/github/license/kasthack-labs/kasthack.NotEmpty.svg)](LICENSE)\n[![.NET Status](https://github.com/kasthack-labs/kasthack.NotEmpty/workflows/.NET/badge.svg)](https://github.com/kasthack-labs/kasthack.NotEmpty/actions?query=workflow%3A.NET)\n[![Patreon pledges](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dkasthack%26type%3Dpledges\u0026style=flat)](https://patreon.com/kasthack)\n[![Patreon patrons](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dkasthack%26type%3Dpatrons\u0026style=flat)](https://patreon.com/kasthack)\n\n## What?\n\nkasthack.Empty is a library for recursively checking objects for emptinness(being null, default value, an empty collection or a string). It saves you from writing boilerplate in tests for deserializers / parsers / API clients.\n\n## Why does this exist?\n\nManually checking properties for emptinness leaves an opportunity to miss something and makes the developer to write boilerplate.\n\n## Usage\n\n1. Install the appropriate package\n\n* [Nunit](https://www.nuget.org/packages/kasthack.NotEmpty.Nunit/)\n* [Xunit](https://www.nuget.org/packages/kasthack.NotEmpty.Xunit/)\n* [MsTest](https://www.nuget.org/packages/kasthack.NotEmpty.MsTest/)\n* [\u0026lt;no frameworks\u0026gt;](https://www.nuget.org/packages/kasthack.NotEmpty.Raw/)\n\n2. Check your objects / their properties for emptinness. Look at the \u003ca href=\"src/kasthack.NotEmpty.Tests/NotEmptyTestBase.cs\"\u003etests\u003c/a\u003e for more details.\n\n````csharp\nusing kasthack.NotEmpty.Xunit;  // replace the namespace to match your test framework\n\npublic class MyAmazingTest\n{\n    [Fact]\n    public void MyThingWorks()\n    {\n        var targetObject = MyClass.GetResult();\n\n        targetObject.NotEmpty();\n\n        //\u003cactual asserts\u003e\n    }\n\n    [Fact]\n    public void TestOptions()\n    {\n        // won't throw\n        new {\n            PropertyThanLegitimatelyCanBeAnEmptyStringButNotNull = \"\",\n        }.NotEmpty(new AssertOptions {\n            AllowEmptyStrings = true,\n        });\n\n        //won't throw\n        new {\n            PropertyThanLegitimatelyCanBeAnEmptyCollectionButNotNull = new int[]{},\n        }.NotEmpty(new AssertOptions {\n            AllowEmptyCollections = true,\n        });\n\n        // won't throw\n        new {\n            FileContentThatObviouslyContainsSomeNullBytes = new byte[]{ 0 }\n        }.NotEmpty(new AssertOptions {\n            AllowZerosInNumberArrays = true\n        });\n\n        // won't throw BUT will stop at 200 iterations\n        // default MaxDepth is 100\n        new {\n            DeeplyNestedObject = new InfiniteNestedStruct()\n        }.NotEmpty(new AssertOptions {\n            MaxDepth = 200\n        });\n\n        // won't throw\n        new ComputedProperty().NotEmpty(new AssertOptions {\n            IgnoreComputedProperties = true\n        })\n    }\n\n    public struct InfiniteNestedStruct\n    {\n        public int Value { get; set; } = 1;\n\n        public InfiniteNestedStruct Child =\u003e new InfiniteNestedStruct { Value = this.Value + 1 };\n    }\n\n    public class ComputedProperty\n    {\n        public int Value =\u003e 0;\n    }\n}\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasthack-labs%2Fkasthack.notempty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkasthack-labs%2Fkasthack.notempty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasthack-labs%2Fkasthack.notempty/lists"}