tpierrain/NFluent

Non-throwing methods returning null don't pass DoesNotThrow()

bacar opened this issue · 7 comments

bacar commented

Bug Type
Please pick one:

  • a check failed to detect an error (false negative), i.e. a test is green while it should be red.
  • a check raised a non existing error (false positive), i.e a test is red while it should be green.
  • an error message is invalid/incomplete (please provide samples)
  • a ran into an exception.
  • other.

Describe the bug

The following test should pass, but does not:

    [Test]
    public void NonThrowingMethodsReturningNull()
    {
        object ReturnNull() => null;
        ReturnNull(); // does not throw
        Check.ThatCode(() => ReturnNull()).DoesNotThrow();
    }

The exception originates in NFluent.Extensions.ObjectExtensions.IsAwaitable[T] -- it does not deal with nulls.

Desktop (please complete the following information):

  • NFluent version: 3.0.2.500
  • Net Version: Fwmk 4.8
dupdob commented

I just published a beta version with a fix of this (and 342 as well)

bacar commented

Awesome - just tried, fixes my issues.

dupdob commented

as you seem to be exploring, I propose to wait for a couple of weeks before releasing the fix; this will give you time to raise other issues you may find and have a single release, vs several ones for each issue found :-)

bacar commented

I've finished running the upgrade against our codebase FWIW, no further issues found.

bacar commented

Bonne année ! Any chance of a non-beta release? Thank you so much!

dupdob commented

Happy new year as well.
I published V 3.0.3 final this morning.
Note: since the new solution architecture (using multitargeting) is not CI level ready yet, I have to build and publish them manually, something I am reluctant to do, but on the other hand I do not have enough bandwidth to complete the migration 😄.

Excellent, thank you! Finally merged our upgrade from 2.7.2!