-
Notifications
You must be signed in to change notification settings - Fork 289
Closed
Description
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.)
304NotModified, HeroMaxPower and Mertsch
Metadata
Metadata
Assignees
Labels
No labels