/// <summary> /// Checks if the assertion holds, and if not it throws an /// <see cref="AssertionFailureException"/> exception. /// </summary> /// <param name="predicate">Predicate</param> /// <param name="s">Message</param> /// <param name="args">Message arguments</param> public virtual void Assert(bool predicate, string s, params object[] args) { if (!predicate) { var exception = new AssertionFailureException(IO.Utilities.Format(s, args)); this.RaiseOnFailureEvent(exception); throw exception; } }
/// <summary> /// Checks if the assertion holds, and if not it throws an /// <see cref="AssertionFailureException"/> exception. /// </summary> /// <param name="predicate">Predicate</param> public virtual void Assert(bool predicate) { if (!predicate) { var exception = new AssertionFailureException("Detected an assertion failure."); this.RaiseOnFailureEvent(exception); throw exception; } }