Exemplo n.º 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 Requires <TException>(Func <bool> condition, params object[] args) where TException : Exception => ContractOperations.Requires <TException>(condition, args);
Exemplo n.º 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>
 public static void Requires <TException>(Func <bool> condition) where TException : Exception => ContractOperations.Requires <TException>(condition, StringConstants.MessageRequiresError);
Exemplo n.º 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>
 /// <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 Requires <TException>(Func <bool> condition, string message) where TException : Exception => ContractOperations.Requires <TException>(condition, message);
Exemplo n.º 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>
 /// <param name="condition">The conditional expression to test.</param>
 public static void Requires(bool condition) => ContractOperations.Requires <Exception>(() => condition, StringConstants.MessageRequiresError);
Exemplo n.º 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>
 /// <param name="message">The message that describes the error.</param>
 public static void Requires(Func <bool> condition, string message) => ContractOperations.Requires <Exception>(condition, message);
Exemplo n.º 6
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(Func <bool> condition) => ContractOperations.Ensures <Exception>(condition, StringConstants.MessageRequiresError);
Exemplo n.º 7
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>(bool condition, params object[] args) where TException : Exception => ContractOperations.Ensures <TException>(() => condition, args);
Exemplo n.º 8
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>(bool condition, string message) where TException : Exception => ContractOperations.Ensures <TException>(() => condition, message);
Exemplo n.º 9
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>(bool condition) where TException : Exception => ContractOperations.Ensures <TException>(() => condition, StringConstants.MessageRequiresError);
Exemplo n.º 10
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(bool condition, string message) => ContractOperations.Ensures <Exception>(() => condition, message);