In constract to e.g. Assert.False
where I can supply a message to be displayed when the assert fails, e.g. Assert.NotNull
has only one overload that just takes the object to check. Is there a reason for it?
namespace Xunit
{
public class Assert
{
// ...
public static void False(bool condition, string userMessage);
// ...
public static void NotNull(object @object);
// ...
}
}
NotNull(Object, String, Object[]) Verifies that the object that is passed in is not equal to null If the object is null then an AssertionException is thrown.
Dogma. They believe that you should never have more than one assertion per test, thus you don't need it.
The solution, if you otherwise like xUnit, is to download the source code for just the Assert module and paste it into your project. It is separate from everything else specifically so that you can tailor it to your needs.
Here is my version of said library with messages added: https://github.com/docevaad/Chain/tree/master/Tortuga.Chain/xTests.Tortuga.Chain.SqlServer.source/shared/Asserts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With