Currently, there are helper functions in the Expect module named isNull and isNotNull for checking if a reference type is null. I think that it would be beneficial to have similar helper functions for Nullable<'t>. It is currently possible to work around this either by using Expect.isTrue x.HasValue in your test or defining the helper functions for yourself, but it seems to me like this would be a good thing to have built in.
Currently, I am defining the helper functions in my test library like so:
module Expect =
let isNullValue (x: Nullable<'t>) message =
if not x.HasValue then ()
else failtestf "%s. Expected null, but was %A." message x
let isNotNullValue (x: Nullable<'t>) message =
if x.HasValue then ()
else failtestf "%s. Expected non-null, but was null." message
I would be happy to PR this if it is something you would be interested in. Thanks!
Currently, there are helper functions in the
Expect
module namedisNull
andisNotNull
for checking if a reference type is null. I think that it would be beneficial to have similar helper functions forNullable<'t>
. It is currently possible to work around this either by usingExpect.isTrue x.HasValue
in your test or defining the helper functions for yourself, but it seems to me like this would be a good thing to have built in.Currently, I am defining the helper functions in my test library like so:
I would be happy to PR this if it is something you would be interested in. Thanks!