Bny.UnitTests
1.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Bny.UnitTests --version 1.0.1
NuGet\Install-Package Bny.UnitTests -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bny.UnitTests" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bny.UnitTests --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bny.UnitTests, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Bny.UnitTests as a Cake Addin #addin nuget:?package=Bny.UnitTests&version=1.0.1 // Install Bny.UnitTests as a Cake Tool #tool nuget:?package=Bny.UnitTests&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bny.UnitTests
Bny.UnitTests is a library that makes unit testing in C# simpler.
In this repository
- Bny.UnitTests - the library
- Bny.UnitTests.Tests - unit tests
- Bny.UnitTests.Examples - example usage
How to use
- for detailed examples see Bny.UnitTests.Examples
Prepare your test classes
[UnitTest] // marh test classes with the [UnitTest] attribute
class TestSomething
{
[UnitTest] // mark test functions with the [UnitTest] attribute
static void Test_SomePart(Asserter a)
{ // all the test functions must have signature same as Action<Asserter>
a.Assert(/* your assertion */);
a.Assert(/* your next assertion */);
// ...
}
[UnitTest]
static void Test_OtherPart(Asserter a)
{
a.Assert(SomeHelperFunction(/* parameters */));
// ...
}
static bool SomeHelperFunction(/* parameters */) { /* ... */ }
}
[UnitTest]
class TestSomethingElse { /* ... */ }
Run all the tests
Use the Tester.TestAll
method to run all the tests in all the classes with the [UnitTest]
attribute
Tester.TestAll();
Tester.TestAll parameters
logAmount
: changes the amount of information written to the output- default value is
LogAmount.Default
- default value is
@out
: the output writer- default value is
null
which meansConsole.Out
(standard output stream)
- default value is
formatted
: determines whether the output is formatted with ANSI escape codes (colors)- default value is
true
- default value is
Example output
(Default parameters)
Links
- Author: BonnyAD9
- Github Repository: Bny.UnitTests
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.