Bny.UnitTests is a library that makes unit testing in C# simpler.
- Bny.UnitTests - the library
- Bny.UnitTests.Tests - unit tests
- Bny.UnitTests.Examples - example usage
- Documentation - Doxygen generated documentation
- for detailed examples see Bny.UnitTests.Examples
[UnitTest] // mark 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 { /* ... */ }
Use the Tester.TestAll
method to run all the tests in all the classes with the [UnitTest]
attribute
Tester.TestAll();
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
This library is available as a NuGet Package
- Documentation: Doxygen
- Author: BonnyAD9
- Github Repository: Bny.UnitTests
- NuGet Package: Bny.UnitTests
- My Website: bonnyad9.github.io