You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose adding the following overloads for handling nullable Booleans:
public static void IsTrue(bool? condition);
public static void IsTrue(bool? condition, string message);
public static void IsTrue(bool? condition, string message, params object[] parameters);
public static void IsFalse(bool? condition);
public static void IsFalse(bool? condition, string message);
public static void IsFalse(bool? condition, string message, params object[] parameters);
They would work exactly like their non-nullable versions.
Reasoning
When checking a Nullable value, we can't use the IsTrue and IsFalse shortcuts. Instead we have to use the longform of Assert.AreEqual( [true|false], which is more error prone because it isn't type safe.
There is also a very minor performance hit with AreEqual because it boxes by default. (You can use AreEqual( (bool?) true, but no one is going to.)
The text was updated successfully, but these errors were encountered:
I propose adding the following overloads for handling nullable Booleans:
They would work exactly like their non-nullable versions.
Reasoning
When checking a Nullable value, we can't use the
IsTrue
andIsFalse
shortcuts. Instead we have to use the longform ofAssert.AreEqual( [true|false]
, which is more error prone because it isn't type safe.There is also a very minor performance hit with
AreEqual
because it boxes by default. (You can useAreEqual( (bool?) true,
but no one is going to.)The text was updated successfully, but these errors were encountered: