Exemple #1
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <typeparam name="TException">Type of condition to by thrown.</typeparam>
 /// <param name="condition">The conditional expression to test.</param>
 /// <param name="args">An object array that contains zero or more objects to format.</param>
 public static void Ensures <TException>(Func <bool> condition, params object[] args) where TException : Exception => ContractOperations.Ensures <TException>(condition, args);
Exemple #2
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <typeparam name="TException">Type of condition to by thrown.</typeparam>
 /// <param name="condition">The conditional expression to test.</param>
 /// <param name="message">The message that describes the error.</param>
 public static void Ensures <TException>(Func <bool> condition, string message) where TException : Exception => ContractOperations.Ensures <TException>(condition, message);
Exemple #3
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <param name="condition">The conditional expression to test.</param>
 /// <param name="message">The message that describes the error.</param>
 public static void Ensures(Func <bool> condition, string message) => ContractOperations.Ensures <Exception>(condition, message);
Exemple #4
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <typeparam name="TException">Type of condition to by thrown.</typeparam>
 /// <param name="condition">The conditional expression to test.</param>
 public static void Ensures <TException>(Func <bool> condition) where TException : Exception => ContractOperations.Ensures <TException>(condition, StringConstants.MessageRequiresError);
Exemple #5
0
 /// <summary>
 /// Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
 /// </summary>
 /// <param name="condition">The conditional expression to test.</param>
 public static void Ensures(bool condition) => ContractOperations.Ensures <Exception>(() => condition, StringConstants.MessageRequiresError);