Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kbrashears5/net-standard-test-helper
Collection of helpers for unit testing with Net Standard
https://github.com/kbrashears5/net-standard-test-helper
assert helper netstandard nunit test xunit
Last synced: 17 days ago
JSON representation
Collection of helpers for unit testing with Net Standard
- Host: GitHub
- URL: https://github.com/kbrashears5/net-standard-test-helper
- Owner: kbrashears5
- License: mit
- Created: 2020-04-19T20:53:29.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-01T11:08:34.000Z (about 1 year ago)
- Last Synced: 2025-01-01T04:17:55.394Z (19 days ago)
- Topics: assert, helper, netstandard, nunit, test, xunit
- Language: C#
- Homepage: https://github.com/kbrashears5/net-standard-test-helper
- Size: 56.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Net Standard Test Helpers
Collection of helpers for unit testing with Net Standard
[![Build Status](https://dev.azure.com/kbrashears5/github/_apis/build/status/kbrashears5.net-standard-test-helper?branchName=master)](https://dev.azure.com/kbrashears5/github/_build/latest?definitionId=5&branchName=master)
[![Tests](https://img.shields.io/azure-devops/tests/kbrashears5/github/4)](https://img.shields.io/azure-devops/tests/kbrashears5/github/4)
[![Code Coverage](https://img.shields.io/azure-devops/coverage/kbrashears5/github/4)](https://img.shields.io/azure-devops/coverage/kbrashears5/github/4)[![nuget](https://img.shields.io/nuget/v/NetStandardTestHelper.svg)](https://www.nuget.org/packages/NetStandardTestHelper/)
[![nuget](https://img.shields.io/nuget/dt/NetStandardTestHelper)](https://img.shields.io/nuget/dt/NetStandardTestHelper)## Usage
Use the static class `TestHelper` to help assert guard clause, exceptions, and more.### Test Values
Use the static class `TestValues` to use some common objects in a way that doesn't clutter your testing, and let your code be your comments for your tests. Pass the following to your functions:
```c#
Class.Function(TestValues.EmptyString);
```
instead of
```c#
Class.Function(null);
```### Xunit
```c#
[Fact]
public void Test()
{
var ex = Assert.Throws(() => Class.Function(null));TestHelper.AssertArgumentNullException(exception: exception,
parameterName: "parameterName");
}
```### Nunit
```c#
[TestCase]
public void Test()
{
var ex = Assert.Throws(() => Class.Function(null));TestHelper.AssertArgumentNullException(exception: exception,
parameterName: "parameterName");
}
```