/// <summary> /// Verify that <paramref name="parameterValue"/> is not null, not empty and contains other characters than white space. /// </summary> public static void RequireNotNullOrWhitespace(string parameterValue, string parameterName, string customMessage = null) { GenericContract <FulcrumServiceContractException> .RequireNotNullOrWhitespace(parameterValue, parameterName, customMessage); }
/// <summary> /// Always fail, with the given <paramref name="message"/>. /// </summary> public static void Fail(string message) { RequireNotNull(message, nameof(message)); GenericContract <FulcrumServiceContractException> .Fail(message); }
/// <summary> /// Verify that <paramref name="parameterValue"/> is not the default value for this type. /// </summary> public static void RequireNotDefaultValue <TParameter>(TParameter parameterValue, string parameterName, string customMessage = null) { GenericContract <FulcrumServiceContractException> .RequireNotDefaultValue(parameterValue, parameterName, customMessage); }
/// <summary> /// Verify that <paramref name="value"/> is null or not matches the regular expression <paramref name="regularExpression"/>. /// </summary> public static void MatchesNotRegExp(string regularExpression, string value, string errorLocation, string customMessage = null) { RequireNotNullOrWhitespace(regularExpression, nameof(regularExpression)); RequireNotNull(errorLocation, nameof(errorLocation)); GenericContract <FulcrumServiceContractException> .RequireMatchesNotRegExp(regularExpression, value, errorLocation, customMessage); }
/// <summary> /// Verify that <paramref name="parameterValue"/> is null or matches the regular expression <paramref name="regularExpression"/>. /// </summary> public static void MatchesRegExp(string regularExpression, string parameterValue, string parameterName, string customMessage = null) { RequireNotNullOrWhitespace(regularExpression, nameof(regularExpression)); RequireNotNull(parameterName, nameof(parameterName)); GenericContract <FulcrumServiceContractException> .RequireMatchesRegExp(regularExpression, parameterValue, parameterName, customMessage); }
/// <summary> /// Verify that <paramref name="expression"/> return true, when applied to <paramref name="parameterValue"/>. /// </summary> public static void Require <TParameter>(TParameter parameterValue, Expression <Func <TParameter, bool> > expression, string parameterName) { GenericContract <FulcrumServiceContractException> .Require(parameterValue, expression, parameterName); }
/// <summary> /// Verify that <paramref name="mustBeTrue"/> really is true. /// </summary> public static void Require(bool mustBeTrue, string message) { InternalContract.RequireNotNullOrWhitespace(message, nameof(message)); GenericContract <FulcrumServiceContractException> .Require(mustBeTrue, message); }
public static void Require(Expression <Func <bool> > expression, string message) { InternalContract.RequireNotNullOrWhitespace(message, nameof(message)); GenericContract <FulcrumServiceContractException> .Require(expression, message); }