示例#1
0
 /// <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);
 }
示例#2
0
 /// <summary>
 /// Always fail, with the given <paramref name="message"/>.
 /// </summary>
 public static void Fail(string message)
 {
     RequireNotNull(message, nameof(message));
     GenericContract <FulcrumServiceContractException> .Fail(message);
 }
示例#3
0
 /// <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);
 }
示例#4
0
 /// <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);
 }
示例#5
0
 /// <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);
 }
示例#6
0
 /// <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);
 }
示例#7
0
 /// <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);
 }
示例#8
0
 public static void Require(Expression <Func <bool> > expression, string message)
 {
     InternalContract.RequireNotNullOrWhitespace(message, nameof(message));
     GenericContract <FulcrumServiceContractException> .Require(expression, message);
 }