https://github.com/frankhaugen/frank.testing
A collection of libraries to aid in testing with XUnit
https://github.com/frankhaugen/frank.testing
csharp dotnet nuget testing xunit
Last synced: 4 months ago
JSON representation
A collection of libraries to aid in testing with XUnit
- Host: GitHub
- URL: https://github.com/frankhaugen/frank.testing
- Owner: frankhaugen
- License: mit
- Created: 2023-12-30T13:28:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-13T14:52:35.000Z (about 1 year ago)
- Last Synced: 2025-10-25T15:12:30.915Z (8 months ago)
- Topics: csharp, dotnet, nuget, testing, xunit
- Language: C#
- Homepage:
- Size: 182 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Frank.Testing
A set of nugets to allow for easier testing of dotnet code using xUnit
___
[](LICENSE)
[](https://www.nuget.org/packages/Frank.Testing.Logging)
[](https://www.nuget.org/packages/Frank.Testing.Logging)







___
## Installation
### NuGet
```powershell
Install-Package Frank.Testing
```
### .NET CLI
```bash
dotnet add package Frank.Testing
```
## Usage
### TestOutputHelperExtensions
```csharp
using Xunit;
using Xunit.Abstractions;
public class MyTestClass
{
private readonly ITestOutputHelper _outputHelper;
public MyTestClass(ITestOutputHelper outputHelper)
{
_outputHelper = outputHelper;
}
[Fact]
public void MyTestMethod()
{
_outputHelper.WriteLine(new { MyProperty = "MyValue" }); // Writes to test output as JSON: {"MyProperty":"MyValue"}
_outputHelper.WriteJson(new { MyProperty = "MyValue" }); // Writes to test output as JSON: {"MyProperty":"MyValue"}
}
[Fact]
public void MyTestMethod2()
{
_outputHelper.WriteCSharp(new { MyProperty = "MyValue" }); // Writes to test output as C#: var anonymousType = new { MyProperty = "MyValue" };
}
[Fact]
public void MyTestMethod3()
{
_outputHelper.WriteXml(new MyClass() { Name = "MyName" }); // Writes to test output as XML: MyName
}
}
```