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 IsCloseTo for every numerical types #325

Closed dupdob closed 4 years ago

dupdob commented 4 years ago

As of now (V 2.7) , IsCloseTo is only available for floating numbers (float and double). I have received request to add support for decimal. I propose to extend this request to every numerical types.

Expected Behavior

Support this:

Check.That(1m).IsCloseTo(1, 0.2);
Check.That(1).IsCloseTo(0,1);
Check.That(1b).IsCloseTo(0,1);
...

Current Behavior

Previous examples to not compile.

eOkadas commented 4 years ago

Hello, je viens d'en avoir besoin sur du decimal. Je peux essayer de faire une PR sur ce point si ça peux aider.

je viens de faire un ... Check.That((double)actual).IsCloseTo((double)expected, (double).2m); et ça manquait d'élégance 🙈

eOkadas commented 4 years ago

C'est dans la V3 déjà 😅

dupdob commented 4 years ago

oui, j'ai oublié de te prévenir