sitecore 确保值是对还是错

示例

要断言值是true还是false,请执行以下操作:

Assert.IsFalse(Settings.DoBadThings, "Bad things should not happen, disable DoBadThings.");
Assert.IsTrue(magicNumber =< 42, "魔数大于42!");

您还可以为异常消息传递格式化参数

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