{"id":24309004,"url":"https://github.com/technobre/powerutils.xunit.extensions","last_synced_at":"2025-07-12T02:09:09.325Z","repository":{"id":37740588,"uuid":"388623933","full_name":"TechNobre/PowerUtils.xUnit.Extensions","owner":"TechNobre","description":"Utils, helpers and extensions to create tests with xUnit","archived":false,"fork":false,"pushed_at":"2025-06-16T07:25:45.000Z","size":238,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-05T11:18:50.103Z","etag":null,"topics":["c-sharp","csharp","dotnet","dotnet-core","test","xunit"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/PowerUtils.xUnit.Extensions/","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/TechNobre.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-07-22T23:27:55.000Z","updated_at":"2025-06-16T07:25:47.000Z","dependencies_parsed_at":"2023-02-15T10:10:56.152Z","dependency_job_id":"9232e445-e6c7-43d2-9c71-62eb56e1c1eb","html_url":"https://github.com/TechNobre/PowerUtils.xUnit.Extensions","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/TechNobre/PowerUtils.xUnit.Extensions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TechNobre%2FPowerUtils.xUnit.Extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TechNobre%2FPowerUtils.xUnit.Extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TechNobre%2FPowerUtils.xUnit.Extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TechNobre%2FPowerUtils.xUnit.Extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TechNobre","download_url":"https://codeload.github.com/TechNobre/PowerUtils.xUnit.Extensions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TechNobre%2FPowerUtils.xUnit.Extensions/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264923469,"owners_count":23683753,"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":["c-sharp","csharp","dotnet","dotnet-core","test","xunit"],"created_at":"2025-01-17T05:12:08.804Z","updated_at":"2025-07-12T02:09:09.276Z","avatar_url":"https://github.com/TechNobre.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PowerUtils.xUnit.Extensions\n\n![Logo](https://raw.githubusercontent.com/TechNobre/PowerUtils.xUnit.Extensions/main/assets/logo/logo_128x128.png)\n\n***Utils, helpers and extensions to create tests with xUnit***\n\n![Tests](https://github.com/TechNobre/PowerUtils.xUnit.Extensions/actions/workflows/tests.yml/badge.svg)\n[![Mutation tests](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FTechNobre%2FPowerUtils.xUnit.Extensions%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/TechNobre/PowerUtils.xUnit.Extensions/main)\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=TechNobre_PowerUtils.xUnit.Extensions\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=TechNobre_PowerUtils.xUnit.Extensions)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=TechNobre_PowerUtils.xUnit.Extensions\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=TechNobre_PowerUtils.xUnit.Extensions)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=TechNobre_PowerUtils.xUnit.Extensions\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=TechNobre_PowerUtils.xUnit.Extensions)\n\n[![NuGet](https://img.shields.io/nuget/v/PowerUtils.xUnit.Extensions.svg)](https://www.nuget.org/packages/PowerUtils.xUnit.Extensions)\n[![Nuget](https://img.shields.io/nuget/dt/PowerUtils.xUnit.Extensions.svg)](https://www.nuget.org/packages/PowerUtils.xUnit.Extensions)\n[![License: MIT](https://img.shields.io/github/license/TechNobre/PowerUtils.xUnit.Extensions.svg)](https://github.com/TechNobre/PowerUtils.xUnit.Extensions/blob/main/LICENSE)\n\n\n- [Support to](#support-to)\n- [Dependencies](#dependencies)\n- [How to use](#how-to-use)\n  - [Install NuGet package](#install-nuget-package)\n  - [Extensions](#extensions)\n    - [object.InvokeNonPublicMethod();](#objectinvokenonpublicmethod)\n    - [object.SetNonPublicProperty(); and object.SetNonPublicField()](#objectsetnonpublicproperty-and-objectsetnonpublicfield)\n  - [Helpers](#helpers)\n    - [Sort tests by priority](#sort-tests-by-priority)\n    - [InvokeStaticNonPublicMethod](#invokestaticnonpublicmethod)\n  - [Factories](#factories)\n    - [ObjectFactory](#objectfactory)\n- [Contribution](#contribution)\n\n\n\n## Support to\u003ca name=\"support-to\"\u003e\u003c/a\u003e\n- .NET 9.0\n- .NET 8.0\n- .NET 7.0\n- .NET 6.0\n- .NET 5.0\n- .NET 3.1\n- .NET Standard 2.1\n- .NET Framework 4.6.2 or more\n\n\n\n## Dependencies\u003ca name=\"dependencies\"\u003e\u003c/a\u003e\n\n- xunit.extensibility.core [NuGet](https://www.nuget.org/packages/xunit.extensibility.core/)\n\n\n\n## How to use\u003ca name=\"how-to-use\"\u003e\u003c/a\u003e\n\n### Install NuGet package\u003ca name=\"Installation\"\u003e\u003c/a\u003e\nThis package is available through Nuget Packages: https://www.nuget.org/packages/PowerUtils.xUnit.Extensions\n\n**Nuget**\n```bash\nInstall-Package PowerUtils.xUnit.Extensions\n```\n\n**.NET CLI**\n```\ndotnet add package PowerUtils.xUnit.Extensions\n```\n\n### Extensions\u003ca name=\"Extensions\"\u003e\u003c/a\u003e\n\n#### object.InvokeNonPublicMethod();\u003ca name=\"object.InvokeNonPublicMethod\"\u003e\u003c/a\u003e\nExtension to invoke non-public methods\n\n```csharp\npublic class SampleClass\n{\n    private bool _methodName1(int value)\n    {\n        return false;\n    }\n\n    private bool _methodName2()\n    {\n        return true;\n    }\n\n    private void _methodName3(int value)\n    {\n    }\n\n    private void _methodName4()\n    {\n    }\n\n    private Task\u003cbool\u003e _methodName5Async()\n    {\n    }\n\n    private Task _methodName6Async()\n    {\n    }\n}\n```\n\n```csharp\nvar sampleClass = new SampleClass();\n\nvar result1 = sampleClass.InvokeNonPublicMethod\u003cbool\u003e(\"_methodName1\", 1);\nvar result2 = sampleClass.InvokeNonPublicMethod\u003cbool\u003e(\"_methodName2\");\n\nsampleClass.InvokeNonPublicMethod(\"_methodName3\", 532);\nsampleClass.InvokeNonPublicMethod(\"_methodName4\");\n\nvar result3 = await sampleClass.InvokeNonPublicMethodAsync\u003cbool\u003e(\"_methodName5Async\", 1);\nawait sampleClass.InvokeNonPublicMethodAsync(\"_methodName6Async\");\n```\n\n\n\n#### object.SetNonPublicProperty(); and object.SetNonPublicField()\u003ca name=\"object.SetNonPublicProperty\"\u003e\u003c/a\u003e\nExtensions to set non-public properties and fields\n\n```csharp\npublic class SampleClass\n{\n    public string PropSetPrivate { get; private set; }\n    private string _propPrivate { get; set; }\n    private string _privateField;\n}\n```\n\n```csharp\nvar sampleClass = new SampleClass();\n\nsampleClass.SetNonPublicProperty(p =\u003e p.PropSetPrivate, \"Value\");\nsampleClass.SetNonPublicProperty(\"_propPrivate\", \"Value\");\nsampleClass.SetNonPublicField(\"_privateField\", \"Value\");\n```\n\n\n### Helpers\u003ca name=\"Helpers\"\u003e\u003c/a\u003e\n\n#### Sort tests by priority\u003ca name=\"SortTestsByPriority\"\u003e\u003c/a\u003e\n\n```csharp\n[TestCaseOrderer(PriorityOrderer.Name, PriorityOrderer.Assembly)]\npublic class Tests\n{\n    [Fact, TestPriority(2)]\n    public void Test1()\n    {\n    }\n\n    [Fact, TestPriority(1)]\n    public void Test2()\n    {\n    }\n}\n```\n\n#### InvokeStaticNonPublicMethod\u003ca name=\"InvokeStaticNonPublicMethod\"\u003e\u003c/a\u003e\n\n```csharp\npublic static class SampleClass\n{\n    private static bool _methodName1(int value)\n    {\n        return false;\n    }\n\n    private static bool _methodName2()\n    {\n        return true;\n    }\n\n    private static void _methodName3(int value)\n    {\n    }\n\n    private static void _methodName4()\n    {\n    }\n\n    private static Task\u003cbool\u003e _methodName5Async()\n    {\n    }\n\n    private static Task _methodName6Async()\n    {\n    }\n}\n```\n\n```csharp\nvar result1 = ObjectInvoker.Invoke\u003cbool\u003e(typeof(SampleClass), \"_methodName1\", 1);\nvar result2 = ObjectInvoker.Invoke\u003cbool\u003e(typeof(SampleClass), \"_methodName2\");\n\nObjectInvoker.Invoke(typeof(SampleClass), \"_methodName3\", 532);\nObjectInvoker.Invoke(typeof(SampleClass), \"_methodName4\");\n\nvar result3 = await ObjectInvoker.InvokeAsync\u003cbool\u003e(typeof(SampleClass), \"_methodName5Async\", 1);\nawait ObjectInvoker.InvokeAsync(typeof(SampleClass), \"_methodName6Async\");\n```\n\n\n### Factories\u003ca name=\"Factories\"\u003e\u003c/a\u003e\n\n#### ObjectFactory\u003ca name=\"Factories-ObjectFactory\"\u003e\u003c/a\u003e\nFactory to create an object by non public constructor\n\n```csharp\npublic class TestObject\n{\n    public string Name { get; private set; }\n    public int Age { get; private set; }\n\n    private TestObject()\n    {\n        this.Name = \"Example name\";\n        this.Age = 21;\n    }\n\n    protected TestObject(string name, int age)\n    {\n        this.Name = name;\n        this.Age = age;\n    }\n}\n\nvar obj1 = ObjectFactory.Create\u003cTestObject\u003e();\nvar obj2 = ObjectFactory.Create\u003cTestObject\u003e(\"My name\", 50);\n```\n\n\n\n## Contribution\u003ca name=\"contribution\"\u003e\u003c/a\u003e\n\nIf you have any questions, comments, or suggestions, please open an [issue](https://github.com/TechNobre/PowerUtils.xUnit.Extensions/issues/new/choose) or create a [pull request](https://github.com/TechNobre/PowerUtils.xUnit.Extensions/compare)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnobre%2Fpowerutils.xunit.extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechnobre%2Fpowerutils.xunit.extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnobre%2Fpowerutils.xunit.extensions/lists"}