I´m using FluentAssertions 1.7.0 and the methods HaveValue and NotHaveValue are missing for properties of type Nullable<int>.
For Nullable<DateTime> they are present.
Test:
Nullable<DateTime> date = null;
date.Should().HaveValue(); //Method is present
date.Should().HaveNotValue(); //Method is present
Nullable<int> value= null;
value.Should().HaveValue(); //Method is NOT present
value.Should().HaveNotValue(); //Method is NOT present
I checked the sourcecode and it seems there are assertions available for NullableNumerics, but they are not available.
Comments: ** Comment from web user: dennisdoomen **
For Nullable<DateTime> they are present.
Test:
Nullable<DateTime> date = null;
date.Should().HaveValue(); //Method is present
date.Should().HaveNotValue(); //Method is present
Nullable<int> value= null;
value.Should().HaveValue(); //Method is NOT present
value.Should().HaveNotValue(); //Method is NOT present
I checked the sourcecode and it seems there are assertions available for NullableNumerics, but they are not available.
Comments: ** Comment from web user: dennisdoomen **
I have found the problem. The HaveValue() and NotHaveValue() are extension methods on the NumericAssertions class. I had to do this to prevent duplication in the code-base, but I don't remember the details anymore.
Anyway, your problem is that you need to include the FluentAssertions.Assertions namespace as well. I have been using Resharper for years, so I typically don't have to think about that.