sitecore Ensure a value is true or false


To assert that a value is either true or false,:

Assert.IsFalse(Settings.DoBadThings, "Bad things should not happen, disable DoBadThings.");
Assert.IsTrue(magicNumber =< 42, "The magic number is greater than 42!");

You can also pass formatting parameters for the exception message

Assert.IsFalse(myValue > 5, "The value should not be greater than 5, it's currently {0}", myValue);