tpierrain / NFluent

Smooth your .NET TDD experience with NFluent! NFluent is an ergonomic assertion library which aims to fluent your .NET TDD experience (based on simple Check.That() assertion statements). NFluent aims your tests to be fluent to write (with a super-duper-happy 'dot' auto-completion experience), fluent to read (i.e. as close as possible to plain English expression), but also fluent to troubleshoot, in a less-error-prone way comparing to the classical .NET test frameworks. NFluent is also directly inspired by the awesome Java FEST Fluent assertion/reflection library (http://fest.easytesting.org/)
Apache License 2.0
310 stars 53 forks source link

Add assumptions support #296

Closed dupdob closed 5 years ago

dupdob commented 5 years ago

Purpose is to help to use NFluent in PBT scenarii, and similar situations. Most testing framework supports an Ignore assertion that will mark the test as to ignored when some criteria are not met (vs the usual Assert that marks the test as failed).

Expected Behavior

Assumptions assertions will mark the test as ignored when the criteria are not met.

Current Behavior

This is not supported by NFluent, user must use the framework provided assertion.

Possible Solution

Add an Assume entry point that would raise IgnoreException (or equivalent) when criteria are not met.

....
// this line would mark the test as ignored.
Assume.That(13).IsEqualTo(12);
...

Context

This proposal was made on Twitter by Romeu Moura.

dupdob commented 5 years ago

It turns out you can't use Assume as it conflicst with NUnit, so this will be Assuming instead.

dupdob commented 5 years ago

Feature is implemented